All language subtitles for 006 Array Destructuring_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

Now, let me get rid of that dummy title output and let's work on the overall syntax we're using here

thus far, we're storing this array, we're getting back in the input state, and we can absolutely

do that.

But it means that we have to use input state zero if we want to get the values and input, said one.

If we want to get the function to update the values, of course we can do that.

But it's a bit of hard to understand.

Syntax, for example, that this is a function is not immediately obvious.

We can't use a modern JavaScript syntax to make that easier to understand.

We can use a feature called Array de Structuring.

How does it work?

It allows you to pull elements out of an array and store them in separate variables.

So here where you know that you get an array with exactly two elements, you can add square brackets

on the left side of the equals sign.

So by adding them on the left side, you're not using them to create a new array or anything like that.

That would be the case if you use them on the right side.

But instead, this now is a JavaScript syntax that allows you to pull elements out of that array and

store them in variables.

And you add as many variables here, variable names of your choice here between the square brackets

on the left side as you have elements in the array.

So here we have all these exactly two elements.

So we can add two values here with any names you want.

The first element will be our data.

So here that could be input state and the second will be a function to update that data.

Typically you named as set input state or a set, whatever you name your data because you're well,

setting this to a new value.

You are not merging it.

You're not updating it, you're overriding it.

So you're setting some new data.

So now we're using a restructuring and our input state will be our data and that will be the function

to update the data.

That's way easier to use.

Now we can use input state here without the zero to work with our data and we use set input state instead

of input state one to update our data.

And I think that's much easier to read and to understand that it was before.

To be honest, if we save that, it works just as before.

But now we have a syntax that's way easier to understand.

A side note, of course, this button still doesn't do anything because we haven't hooked up any logic,

but we'll do that step by step.

So this is the syntax will actually use the syntax you see in the official docs you'll see for the rest

of this course and the syntax, which is much better to use when working with the use state hook.

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