All language subtitles for 032 Exercise_ Event Binding_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,050 --> 00:00:02,400 Hey, it's Andre here. 2 00:00:02,610 --> 00:00:07,290 I want to do a quick exercise with you based on what we've learned so far. 3 00:00:07,890 --> 00:00:09,450 This is going to be a little tricky. 4 00:00:09,690 --> 00:00:11,070 So let's see how you do. 5 00:00:11,910 --> 00:00:13,950 I've created here using coast sandbox. 6 00:00:14,190 --> 00:00:16,290 Just a simple basic component. 7 00:00:16,740 --> 00:00:18,180 It's an app component. 8 00:00:19,110 --> 00:00:20,910 And here we have our constructor. 9 00:00:21,480 --> 00:00:26,580 And the important part is this render we're rendering for bundes. 10 00:00:26,730 --> 00:00:29,040 As you can see here, very beautiful page. 11 00:00:29,130 --> 00:00:29,430 I know. 12 00:00:30,330 --> 00:00:38,490 Now, here we actually have four bundes with different ways that we're assigning the handle click function. 13 00:00:39,720 --> 00:00:45,330 The first one actually runs the function like this because of these brackets. 14 00:00:46,380 --> 00:00:49,590 The second one, Hando, quick one, looks like this. 15 00:00:49,800 --> 00:00:52,980 It's defined right here inside of the component. 16 00:00:54,040 --> 00:00:54,860 And it logs. 17 00:00:54,940 --> 00:00:55,790 Button one clicked. 18 00:00:58,860 --> 00:01:02,370 The next one, Handal click two is up here. 19 00:01:03,080 --> 00:01:10,460 It's saying this dot handle click two equals this dot handle, click one dot bind, remember, had to 20 00:01:10,470 --> 00:01:10,740 click. 21 00:01:10,740 --> 00:01:13,380 One is here and binds to this. 22 00:01:14,340 --> 00:01:16,080 And then the next one Handal click. 23 00:01:16,140 --> 00:01:21,370 Three is a function or because this is part of a class. 24 00:01:21,420 --> 00:01:24,600 It's a method that's using arrow functions. 25 00:01:25,270 --> 00:01:28,050 Okay, so what do you think is going to happen? 26 00:01:28,320 --> 00:01:31,080 Remember, this is just a simple component. 27 00:01:31,950 --> 00:01:36,110 All we have is these click handlers. 28 00:01:36,450 --> 00:01:41,760 We actually have one, two and three and all three of them are being used in different way. 29 00:01:42,180 --> 00:01:44,840 I want you to predict what's going to happen first. 30 00:01:45,030 --> 00:01:48,840 I'm going to refresh the page that I'm going to click on one. 31 00:01:49,200 --> 00:01:51,390 Then click on to click on three. 32 00:01:51,540 --> 00:01:52,780 And then click on four. 33 00:01:53,340 --> 00:02:00,330 I want to pause the video and write down what you think is going to show up inside of the console. 34 00:02:00,750 --> 00:02:04,740 So I'm going to open up the console over here and we're gonna go one by one. 35 00:02:05,100 --> 00:02:07,410 So write down what you think's going to happen. 36 00:02:07,530 --> 00:02:08,610 This is a little tricky. 37 00:02:08,820 --> 00:02:10,500 So if you don't get her 100 percent. 38 00:02:10,919 --> 00:02:11,430 Don't worry. 39 00:02:11,550 --> 00:02:12,990 You're not a terrible developer. 40 00:02:13,080 --> 00:02:13,770 We're just learning. 41 00:02:14,310 --> 00:02:14,640 Ready? 42 00:02:15,300 --> 00:02:15,480 All right. 43 00:02:15,510 --> 00:02:16,320 Time for the answer. 44 00:02:17,100 --> 00:02:20,160 I'm going to refresh the page. 45 00:02:20,790 --> 00:02:21,150 All right. 46 00:02:21,660 --> 00:02:24,330 And we see you right away that there's a console. 47 00:02:24,840 --> 00:02:25,890 So let's click over here. 48 00:02:26,400 --> 00:02:28,710 And it looks like button one was clicked. 49 00:02:30,090 --> 00:02:32,910 But I didn't click this button, which just happened. 50 00:02:33,170 --> 00:02:37,560 Well, we're invoking the function whenever we render. 51 00:02:37,680 --> 00:02:37,950 Right. 52 00:02:38,250 --> 00:02:42,000 So here when React renders this. 53 00:02:42,420 --> 00:02:43,750 It runs this function. 54 00:02:43,800 --> 00:02:45,750 Because, well, we call it right here. 55 00:02:46,560 --> 00:02:51,270 This is why we don't call a function when it's an event handler. 56 00:02:51,540 --> 00:02:56,160 We assign it a function so that when the event happens, it actually runs. 57 00:02:56,400 --> 00:03:02,100 So if I click one here, no, nothing happens because there is nothing assigned to it. 58 00:03:02,220 --> 00:03:06,570 This is just we pretty much just said, hey, just run the handle click function. 59 00:03:06,600 --> 00:03:06,930 That's it. 60 00:03:07,620 --> 00:03:08,940 So we don't want to do that. 61 00:03:09,330 --> 00:03:10,170 What about the second one? 62 00:03:10,290 --> 00:03:11,480 Let's click on to here. 63 00:03:13,200 --> 00:03:14,900 I get button one click. 64 00:03:15,360 --> 00:03:15,990 Why is that? 65 00:03:17,120 --> 00:03:21,650 Well, because we now assigned handle click one, which is over here. 66 00:03:22,340 --> 00:03:24,920 And we ran this awesome. 67 00:03:25,810 --> 00:03:32,450 Now if I change this, to have this keyword in it, you see that this refreshed. 68 00:03:32,840 --> 00:03:35,990 And this initially is the app. 69 00:03:36,320 --> 00:03:38,360 But as soon as I click on bond to. 70 00:03:40,210 --> 00:03:41,300 I get undefined. 71 00:03:41,950 --> 00:03:46,060 And this is something that we talked about before with the this keyword. 72 00:03:46,540 --> 00:03:48,610 Now this undefined over here. 73 00:03:48,970 --> 00:03:53,680 If we wrote it like this, would actually refer to the actual button, the actual element here. 74 00:03:55,020 --> 00:03:59,220 All right, enough of that, let's go back let's click on this one over here. 75 00:03:59,460 --> 00:04:00,030 Click three. 76 00:04:00,270 --> 00:04:00,540 Ready? 77 00:04:01,840 --> 00:04:03,830 Well, let's click on to first and then click three. 78 00:04:05,440 --> 00:04:06,550 Button one clicked. 79 00:04:06,940 --> 00:04:07,540 Why is that? 80 00:04:08,440 --> 00:04:10,220 Well, Handal, click to. 81 00:04:11,260 --> 00:04:15,370 And by the way, I don't know if you can hear this, but it is raining really, really hard outside. 82 00:04:15,580 --> 00:04:16,870 So if you can't hear that. 83 00:04:16,990 --> 00:04:19,180 Sorry, but I swear, it's just the rain. 84 00:04:19,570 --> 00:04:19,839 All right. 85 00:04:20,260 --> 00:04:28,570 So Handal click to hear is equal to this dot handle click one, which is this function and we bind this 86 00:04:28,570 --> 00:04:28,750 year. 87 00:04:29,470 --> 00:04:31,660 Now we run this console lock. 88 00:04:31,690 --> 00:04:33,190 But if I change this to. 89 00:04:34,470 --> 00:04:35,070 This now. 90 00:04:36,300 --> 00:04:37,410 And I click on three. 91 00:04:38,610 --> 00:04:39,000 Look at that. 92 00:04:39,270 --> 00:04:40,770 This is now the app. 93 00:04:41,100 --> 00:04:45,120 So this is what we're doing with Bonnie, we're making sure that, hey, this is going to equal the 94 00:04:45,120 --> 00:04:46,650 app because we're going to use it later. 95 00:04:47,250 --> 00:04:47,580 Awesome. 96 00:04:47,850 --> 00:04:48,120 All right. 97 00:04:48,300 --> 00:04:48,840 Final one. 98 00:04:49,020 --> 00:04:50,430 Let's go back to what we had before. 99 00:04:51,640 --> 00:04:52,780 What happens when I click here? 100 00:04:53,720 --> 00:04:55,700 When I click on for. 101 00:04:57,510 --> 00:05:03,490 I get button three clicked because handle click three, which is right over here. 102 00:05:04,270 --> 00:05:05,400 While this just two runs. 103 00:05:05,650 --> 00:05:10,000 If I now console log this and I click run. 104 00:05:10,330 --> 00:05:11,290 Lets click for here. 105 00:05:11,830 --> 00:05:12,230 Look at that. 106 00:05:12,430 --> 00:05:17,620 I get the app without having to do this ugly bind up here that often confuses people. 107 00:05:18,090 --> 00:05:19,570 The Biery of air functions. 108 00:05:20,520 --> 00:05:20,830 All right. 109 00:05:20,980 --> 00:05:22,960 Did you get that if you didn't. 110 00:05:23,140 --> 00:05:23,680 Don't worry. 111 00:05:23,770 --> 00:05:26,170 These are pretty much the rules once you memorize them. 112 00:05:26,680 --> 00:05:27,070 That's it. 113 00:05:27,460 --> 00:05:28,660 It's fairly simple. 114 00:05:28,990 --> 00:05:30,730 So I'll see you in the next video. 8299

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.