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
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

Original subtitles

Now in the last lecture,

we learned about refs

and I showed you that

with refs you have an alternative way

of getting that user input of accessing those input fields.

And I also showed you this

a little bit hacky approach of then

still manipulating the input fields and resetting them

if you want to do that.

Now, this approach of using refs

to interact with dom elements

specifically with input elements also has a special name.

We're talking about uncontrolled components

if we access values with a ref.

So these input components here,

would now be uncontrolled components.

Why uncontrolled?

Because they're internal state,

so to value which is reflected in them

is not controlled by react.

We rely on the default behavior of the input

where a user of course is able to enter something

and that entered value is reflected.

And we then just Fetch it, with a react feature

but we don't feed data back into the input.

When I set a new value to those inputs here

with this work around,

we're absolutely not using react here.

Sure we're using the ref,

but in the end we get access

to the native dom element with that

and I then just use the regular dom API

for setting the value of a dom node of a input dom node.

So that's why this is uncontrolled

because we're not controlling these state

off the input element with react.

Now, you can talk about uncontrolled

and controlled components.

All is in the context of other components,

but most commonly, we have this scenario

when we talk about input components

about form components in general,

because those components

tend to have some internal state natively by the browser,

an input element is configured

to take user input and save and reflect it.

And when we then work with those components in a react app,

we wanna connect our react state to that.

That's why we typically have

this controlled uncontrolled thing

when we work with input components in react.

And when we use refs, like we're doing it here,

we have uncontrolled input components.

The approach we had before,

where we manage our state

and we updated that state on every keystroke

and we feed that state back into the input

with the value prop,

so that approach we had before we added refs,

that would be the controlled approach.

Then we would say

that those input fields are controlled components

because their internal state is controlled by react.

These are simply important terms,

which you should keep in mind for potential interviews

or discussions with other react developers,

because they are typical terms you hear in the react world.

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