All language subtitles for 015 Tapping Into Context with the useContext Hook_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

So lets explore the useContext Hook.

For that here,

I will actually remove

this code, I will

remove to Consumer.

Like this.

And therefore I'm back to my

old navigation Component

but of course now

I'm referring to that

CTX object which simply

doesn't exist anymore.

Now we are still importing

AuthContext, and we can

use it again.

Now by importing a

Hook from React,

and that's the useContext Hook.

Another Hook that's built into React.

And it does what the name implies,

it allows us to use the Context,

it allows us to tap into a Context

and listen to it.

Using it is simple,

you call useContext in your React Component Function,

and you pass the Context appointer at

the Context you want to use to it.

So in our case, I'm pointing to AuthContext.

Now what you get back, is the Context value.

So here...

I'll store this in a CTX Constant

to make my code down there worth again.

And with that,

we can save this.

And it will again, work just fine.

Simply, because I'm using the useContext Hook.

Easy like that.

Simple like that.

This is all we need to do

and this, of course

I would say it's a bit more

elegant and a bit nicer

than using AuthContext Consumer,

which you...

However, just to make this clear,

are always allowed to use.

It's not wrong or anything like that.

This is just a bit more elegant

in my opinion.

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