All language subtitles for 043 useState - Multiple State Values.en_US

af Afrikaans
sq Albanian
am Amharic
ar Arabic
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 Download
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:00,180 --> 00:00:08,040 All right, that is clear, but as you're looking at our setup, you're probably wondering, OK, but 2 00:00:08,040 --> 00:00:12,040 why do we have to even bother with an object in the first place? 3 00:00:12,510 --> 00:00:20,190 Can we set up three separate state values and then whichever we would want to change, of course, we 4 00:00:20,190 --> 00:00:22,110 would use that handler method. 5 00:00:22,290 --> 00:00:23,940 Well, let's try it out. 6 00:00:23,940 --> 00:00:32,520 But I can right away spare you the cliffhanger and said, yeah, that is essentially what you can do. 7 00:00:32,740 --> 00:00:36,230 So in here I'm going to go name and set name. 8 00:00:36,240 --> 00:00:41,780 So I'm going to be somewhat original where I'm not going to go with a wild name for my handler function. 9 00:00:42,150 --> 00:00:47,760 And then again, I'm looking for the same thing, Peter, and then I'll just copy and paste and will 10 00:00:47,910 --> 00:00:55,170 change these values around where now we have age and then we're looking for a set edge and the value 11 00:00:55,170 --> 00:00:57,540 will be 24. 12 00:00:58,050 --> 00:01:00,900 And then the last one, of course, is going to be my message. 13 00:01:01,390 --> 00:01:05,220 So we're going message set message. 14 00:01:05,220 --> 00:01:08,120 That is going to be my function online. 15 00:01:08,160 --> 00:01:09,510 As far as the original value. 16 00:01:09,780 --> 00:01:12,850 When we passed in here, we set random message. 17 00:01:13,230 --> 00:01:17,580 Now, of course, in this case, we are not dealing with objects anymore. 18 00:01:18,060 --> 00:01:20,100 So we have these state values. 19 00:01:20,400 --> 00:01:22,630 So one by one, of course, we will need to access them. 20 00:01:22,950 --> 00:01:26,130 So now I'm looking for a name that I'm looking for a person. 21 00:01:26,470 --> 00:01:28,770 And then lastly, I'm looking for a message. 22 00:01:29,130 --> 00:01:37,230 And when we talk about this change message, well, we can either right away call set message here on 23 00:01:37,230 --> 00:01:37,520 click. 24 00:01:37,950 --> 00:01:42,660 So remember that, of course, we'll have to set up the in line because we're passing in the argument 25 00:01:42,990 --> 00:01:51,900 or since we already have the handler, I can simply pass here and say set and then message and we would 26 00:01:51,900 --> 00:01:54,900 want to change it, of course, to a analog world. 27 00:01:55,230 --> 00:01:56,490 So once we set that up. 28 00:01:56,590 --> 00:01:59,280 Now, once you click course, I have my value. 29 00:01:59,700 --> 00:02:07,110 So essentially what I'm trying to say that there is no rule that prevents you from setting up as many 30 00:02:07,290 --> 00:02:09,450 state values as you would want. 31 00:02:09,840 --> 00:02:18,450 So instead of going for one giant object, you can set up multiple smaller state values where you have 32 00:02:18,450 --> 00:02:22,640 just a single value and a function that controls it. 33 00:02:22,740 --> 00:02:26,250 Or if you do decide, going with an object. 34 00:02:26,250 --> 00:02:32,790 And there's going to be some use cases where object might make a little bit more sense than always, 35 00:02:32,790 --> 00:02:33,900 always, always. 36 00:02:34,170 --> 00:02:39,060 Remember that you need to make sure that you preserve these old values. 37 00:02:39,330 --> 00:02:47,250 And a nifty way of doing that is using a separate operator where essentially we copy the properties 38 00:02:47,370 --> 00:02:52,650 from the previous object and then we just choose whichever we would want to override. 39 00:02:52,800 --> 00:02:55,080 And of course, in this case it was a message. 40 00:02:55,290 --> 00:02:59,430 So we went from random message to a hell of world power. 41 00:02:59,610 --> 00:03:07,470 Yes, there is an alternative where you can set up as many state values as you would want just by calling 42 00:03:07,470 --> 00:03:07,950 your state. 43 00:03:07,950 --> 00:03:14,430 You state passing in default value and then you have that single state value as well as the handler 44 00:03:14,430 --> 00:03:16,710 function for that step value. 4226

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