All language subtitles for 008 Controlled vs Uncontrolled Components_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified) Download
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,220 --> 00:00:03,650 Now in the last lecture, 2 00:00:03,650 --> 00:00:05,160 we learned about refs 3 00:00:05,160 --> 00:00:06,250 and I showed you that 4 00:00:06,250 --> 00:00:08,560 with refs you have an alternative way 5 00:00:08,560 --> 00:00:13,560 of getting that user input of accessing those input fields. 6 00:00:14,190 --> 00:00:15,396 And I also showed you this 7 00:00:15,396 --> 00:00:18,700 a little bit hacky approach of then 8 00:00:18,700 --> 00:00:22,720 still manipulating the input fields and resetting them 9 00:00:22,720 --> 00:00:24,323 if you want to do that. 10 00:00:25,240 --> 00:00:28,490 Now, this approach of using refs 11 00:00:28,490 --> 00:00:30,950 to interact with dom elements 12 00:00:30,950 --> 00:00:35,290 specifically with input elements also has a special name. 13 00:00:35,290 --> 00:00:38,850 We're talking about uncontrolled components 14 00:00:38,850 --> 00:00:41,740 if we access values with a ref. 15 00:00:41,740 --> 00:00:44,001 So these input components here, 16 00:00:44,001 --> 00:00:48,160 would now be uncontrolled components. 17 00:00:48,160 --> 00:00:49,970 Why uncontrolled? 18 00:00:49,970 --> 00:00:52,560 Because they're internal state, 19 00:00:52,560 --> 00:00:55,410 so to value which is reflected in them 20 00:00:55,410 --> 00:00:58,450 is not controlled by react. 21 00:00:58,450 --> 00:01:01,150 We rely on the default behavior of the input 22 00:01:01,150 --> 00:01:03,740 where a user of course is able to enter something 23 00:01:03,740 --> 00:01:06,170 and that entered value is reflected. 24 00:01:06,170 --> 00:01:10,700 And we then just Fetch it, with a react feature 25 00:01:10,700 --> 00:01:14,450 but we don't feed data back into the input. 26 00:01:14,450 --> 00:01:17,600 When I set a new value to those inputs here 27 00:01:17,600 --> 00:01:19,340 with this work around, 28 00:01:19,340 --> 00:01:22,330 we're absolutely not using react here. 29 00:01:22,330 --> 00:01:23,780 Sure we're using the ref, 30 00:01:23,780 --> 00:01:24,613 but in the end we get access 31 00:01:24,613 --> 00:01:26,750 to the native dom element with that 32 00:01:26,750 --> 00:01:29,480 and I then just use the regular dom API 33 00:01:29,480 --> 00:01:34,240 for setting the value of a dom node of a input dom node. 34 00:01:34,240 --> 00:01:36,440 So that's why this is uncontrolled 35 00:01:36,440 --> 00:01:38,930 because we're not controlling these state 36 00:01:38,930 --> 00:01:41,710 off the input element with react. 37 00:01:41,710 --> 00:01:43,970 Now, you can talk about uncontrolled 38 00:01:43,970 --> 00:01:45,600 and controlled components. 39 00:01:45,600 --> 00:01:48,400 All is in the context of other components, 40 00:01:48,400 --> 00:01:51,016 but most commonly, we have this scenario 41 00:01:51,016 --> 00:01:54,180 when we talk about input components 42 00:01:54,180 --> 00:01:56,730 about form components in general, 43 00:01:56,730 --> 00:01:58,067 because those components 44 00:01:58,067 --> 00:02:03,067 tend to have some internal state natively by the browser, 45 00:02:03,210 --> 00:02:04,920 an input element is configured 46 00:02:04,920 --> 00:02:08,070 to take user input and save and reflect it. 47 00:02:08,070 --> 00:02:10,987 And when we then work with those components in a react app, 48 00:02:10,987 --> 00:02:14,420 we wanna connect our react state to that. 49 00:02:14,420 --> 00:02:15,680 That's why we typically have 50 00:02:15,680 --> 00:02:17,640 this controlled uncontrolled thing 51 00:02:17,640 --> 00:02:21,130 when we work with input components in react. 52 00:02:21,130 --> 00:02:23,200 And when we use refs, like we're doing it here, 53 00:02:23,200 --> 00:02:25,550 we have uncontrolled input components. 54 00:02:25,550 --> 00:02:27,290 The approach we had before, 55 00:02:27,290 --> 00:02:28,880 where we manage our state 56 00:02:28,880 --> 00:02:31,670 and we updated that state on every keystroke 57 00:02:31,670 --> 00:02:34,120 and we feed that state back into the input 58 00:02:34,120 --> 00:02:35,450 with the value prop, 59 00:02:35,450 --> 00:02:38,400 so that approach we had before we added refs, 60 00:02:38,400 --> 00:02:41,230 that would be the controlled approach. 61 00:02:41,230 --> 00:02:42,410 Then we would say 62 00:02:42,410 --> 00:02:45,490 that those input fields are controlled components 63 00:02:45,490 --> 00:02:50,030 because their internal state is controlled by react. 64 00:02:50,030 --> 00:02:51,970 These are simply important terms, 65 00:02:51,970 --> 00:02:55,180 which you should keep in mind for potential interviews 66 00:02:55,180 --> 00:02:58,130 or discussions with other react developers, 67 00:02:58,130 --> 00:03:01,973 because they are typical terms you hear in the react world. 5095

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