All language subtitles for 005 Using async _ await_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

Original subtitles

So we are sending a Get request.

This first HTTP request here,

whenever this button is clicked.

Now I mentioned that we're dealing with promises here,

patch returns a promise,

and that's why we have these Then calls.

And just in case it shouldn't be clear,

promises are nothing react specific.

It's a JavaScript language feature.

Now you might be aware that

when you're dealing with promises,

you can build these Then chains here,

so Then call after Then call,

but you can also use an alternative syntax, async await.

You can add the async keyword in front of the function

and then a weight and operation

which is returning a promise.

And it's just a transformation in your code

which behind the scenes basically does the same

as if you do use these Then blocks.

It's just a bit easier to read

because now you can say,

const responds equals await fetch,

and you can remove this Then block,

and you can then say,

const data equals response.json,

and add await in front of that.

And then get rid of that,

and of that,

and simplify to code to look like this.

Now it's still asynchronous code

as you can tell by the async keyword.

It looks synchronous.

It looks like we execute step after step

but behind the scenes, you can imagine,

that it's still transformed to this syntax

you saw a second ago with these Then calls.

I just use async await here,

because it's a bit easier to read, I would argue.

So that's something we can also do

if we're working with promises here.

Again, this is not react specific,

this is also a default JavaScript feature.

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