Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
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.