All language subtitles for 048 useEffect - Conditional.en_US

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
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
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, this is nice.

So we're updating our document title each and every time we click on a button.

And of course, we do that using the use.

However, what if we would want to change our functionality a little bit around where we what if I wouldn't

want to showcase but I have zero messages.

What if I would want to do that?

Only when essentially I have value bigger than zero.

So I only want to showcase that if I have the actual messages.

So what I'm trying to say is I would only want to run it when my value is bigger than zero, because

at the moment notice, of course, we render the component and then sends usufruct runs after every

render well, which we right away do, the functionality that is within the user and our national thinking

would be something like this, where if value is bigger than zero, then of course we would want to

run yours.

Sounds pretty reasonable, right?

But remember, seems like eternity ago when I talked about general rules and I said that we cannot we

cannot place hooks as far as conditionals.

So this work, we right away have a big fat complaint because we cannot call hooks conditionally.

And at that time I said that it doesn't make sense for me to place a USB stick in the conditional.

However, I will do that once we get to a use effect.

And of course, we have finally arrived at the user, for example, which technically would make sense

to place it in the conditional.

However, we cannot do that because of the rules of the House.

So just keep that in mind.

Now, the question, of course, is, well, how we can fix that?

And one of the ways how we can do that is by setting up if and else inside of the callback function.

So the point of this video is to showcase that even though you cannot place hooks in the conditional,

similarly how we work with a set function where we set up a conditional and then depending on the value,

we called the set function with some specific value, the same thing we can do in the use effect.

Where inside of that callback function, yes, we can set up a if an all statement.

So how is that going to look like?

Well, in here I could say if value is bigger than one, only then I would want to update document title.

So what happens?

Norrish on the initial render?

Nothing happens even though we still call this user.

So we still call it.

However, in the years affecting the callback function, we have a conditional where I'm checking the

value and I only would want to update document title if the value is bigger than one.

So on our initial render, nothing happens.

However, once I click the button.

Now, of course, the value is one.

So again, nothing happens.

So I guess in this case we can either look for bigger or equals and you'll notice how now once the actual

number is one.

And of course, I'm also updating right away the title because it matches my condition.

Hopefully that makes sense where we cannot place the hooks in the conditionals, something we already

covered before.

However, as far as setting up the conditionals within the callback function, yes, we can definitely

do that.

And it is not against the rules.

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