All language subtitles for 008 Rules of Hooks_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)
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

So we spend a lot of time on you state, but it is the most important state react, offers, react,

offers more hooks than just use state, but it really is an important hook.

If we analyze it, then it's clear that the idea behind you state is that we can manage state in a functional

component by calling you state with some initial state which we can set up.

You don't have to pass an initial state.

By the way, if you want to have null or undefined as initial state, you simply pass no argument at

all to use state.

And this creates a state which is managed by Riak behind the scenes and which survives referendum cycles

and what you get backed by your state is that array with exactly two elements a pointer at your state.

That's the first element and a state update function.

That's the second element.

This is how you state works.

Now, there are two important rules when you work with Hooke's, with any Hooke's, not just with use

state, but also with any other rehook you'll learn about in this module.

For one, you must only use the hooks in functional components or inside of Abre custom hooks, which

will build later.

The second important rule is that you always have to use the hooks on the root level in your component.

Now, what does this mean?

It means that you can't use a hook in the nested function.

Here I have to submit Handler, which isn't doing much right now, but we can't use use state in here,

for example.

And actually we already get an error here because modern reac projects already have code checks which

determined that this year is using a hook in something that's never a react function component nor another

hook, and therefore it's not allowed to use it here.

You're also not allowed to, for example, use a hook in some if statement.

So if you had some condition and then you want to create some state that's also not allowed here.

Unfortunately, my project doesn't determine that this is wrong, but this is simply not allowed.

You must not use your hooks in a for loop.

And if statement or in another function, use it on the root level of your functional component or on

the root level of approx.

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