All language subtitles for 012 Understanding useEffect() Dependencies_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
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,250 --> 00:00:08,700 So we learned about U.S. effect, just like with you state, you can have multiple use affect calls 2 00:00:08,700 --> 00:00:13,270 in one in the same component, you can have as many as you want, just as with the U.S. state. 3 00:00:13,650 --> 00:00:17,790 So here I could have another use of effect call and in dysfunction. 4 00:00:17,830 --> 00:00:22,200 Just want to console log rendering ingredients. 5 00:00:22,900 --> 00:00:25,140 I'm not specifying a second argument. 6 00:00:25,140 --> 00:00:29,290 And therefore, this will run for every well, Virender cycle here. 7 00:00:29,700 --> 00:00:36,600 So for now, saved, as you see, it runs twice reason for dad, simply as this component gets rendered 8 00:00:37,140 --> 00:00:39,270 and then dispersed. 9 00:00:39,270 --> 00:00:42,350 Effect also executes and goes ahead, fetches data. 10 00:00:42,810 --> 00:00:44,330 So that's the first render cycle. 11 00:00:44,340 --> 00:00:48,840 And then once the state of searching is done, which happens in the future because it takes a while, 12 00:00:49,050 --> 00:00:54,060 only a few milliseconds, but still then we opted to state and hence we rendered this component again. 13 00:00:54,060 --> 00:00:56,010 And therefore we have a never rendered cycle. 14 00:00:56,010 --> 00:00:58,380 And that's why we see rendering ingredients twice here. 15 00:00:59,250 --> 00:01:04,590 So you can have multiple use effect calls and you can control how they execute with this second argument, 16 00:01:04,590 --> 00:01:05,560 with this array. 17 00:01:06,150 --> 00:01:12,600 Now, you should configure disarray in an honest way, though, so you should really specify your dependencies 18 00:01:12,840 --> 00:01:17,340 if you have a dependency like sub, for example, here. 19 00:01:18,290 --> 00:01:24,410 I'm outputting user ingredients, then you should specify it, you can, of course, omit the second 20 00:01:24,560 --> 00:01:27,860 argument if you know you want to Ronda's for every Virender cycle. 21 00:01:28,490 --> 00:01:33,440 But if you know, you only want to run as if it has changed, you should specify that this case user 22 00:01:33,440 --> 00:01:35,720 ingredients is a dependency of the second effect. 23 00:01:35,720 --> 00:01:40,280 And this means the dysfunction here will now only run when user ingredients changed. 24 00:01:40,550 --> 00:01:44,260 Right now in this app, that's the same as running it on every renderer cycle. 25 00:01:44,510 --> 00:01:50,810 But if we had something else that could be executed, which also renders this, let's say we had some 26 00:01:50,810 --> 00:01:56,420 other value, we're managing in there, which we can change with a set state called in the end, then 27 00:01:56,900 --> 00:02:02,630 dysfunction would only execute of user ingredients changed and not have that abre value changed. 28 00:02:03,600 --> 00:02:09,150 And we'll see that concept of having arguments here throughout this module, because it is very important. 29 00:02:09,900 --> 00:02:14,850 So that's use of fact and how you can configure it or at least the basics about the use effect. 30 00:02:15,390 --> 00:02:18,590 But there is more to use effect than what we see thus far. 3369

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