All language subtitles for 015 Tapping Into Context with the useContext Hook_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian Download
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,120 --> 00:00:04,540 So lets explore the useContext Hook. 2 00:00:04,540 --> 00:00:05,700 For that here, 3 00:00:05,700 --> 00:00:07,510 I will actually remove 4 00:00:07,510 --> 00:00:08,520 this code, I will 5 00:00:08,520 --> 00:00:10,153 remove to Consumer. 6 00:00:12,230 --> 00:00:13,223 Like this. 7 00:00:15,890 --> 00:00:17,000 And therefore I'm back to my 8 00:00:17,000 --> 00:00:18,330 old navigation Component 9 00:00:18,330 --> 00:00:19,163 but of course now 10 00:00:19,163 --> 00:00:20,010 I'm referring to that 11 00:00:20,010 --> 00:00:21,650 CTX object which simply 12 00:00:21,650 --> 00:00:23,063 doesn't exist anymore. 13 00:00:24,160 --> 00:00:24,993 Now we are still importing 14 00:00:24,993 --> 00:00:26,870 AuthContext, and we can 15 00:00:26,870 --> 00:00:27,980 use it again. 16 00:00:27,980 --> 00:00:29,930 Now by importing a 17 00:00:29,930 --> 00:00:31,110 Hook from React, 18 00:00:31,110 --> 00:00:34,110 and that's the useContext Hook. 19 00:00:34,110 --> 00:00:36,780 Another Hook that's built into React. 20 00:00:36,780 --> 00:00:38,670 And it does what the name implies, 21 00:00:38,670 --> 00:00:40,860 it allows us to use the Context, 22 00:00:40,860 --> 00:00:43,140 it allows us to tap into a Context 23 00:00:43,140 --> 00:00:44,253 and listen to it. 24 00:00:45,280 --> 00:00:46,115 Using it is simple, 25 00:00:46,115 --> 00:00:50,290 you call useContext in your React Component Function, 26 00:00:50,290 --> 00:00:53,740 and you pass the Context appointer at 27 00:00:53,740 --> 00:00:55,470 the Context you want to use to it. 28 00:00:55,470 --> 00:00:58,303 So in our case, I'm pointing to AuthContext. 29 00:01:00,010 --> 00:01:04,170 Now what you get back, is the Context value. 30 00:01:04,170 --> 00:01:05,670 So here... 31 00:01:05,670 --> 00:01:07,910 I'll store this in a CTX Constant 32 00:01:07,910 --> 00:01:10,063 to make my code down there worth again. 33 00:01:12,040 --> 00:01:13,450 And with that, 34 00:01:13,450 --> 00:01:14,780 we can save this. 35 00:01:14,780 --> 00:01:17,580 And it will again, work just fine. 36 00:01:17,580 --> 00:01:21,420 Simply, because I'm using the useContext Hook. 37 00:01:21,420 --> 00:01:22,253 Easy like that. 38 00:01:22,253 --> 00:01:23,170 Simple like that. 39 00:01:23,170 --> 00:01:24,390 This is all we need to do 40 00:01:24,390 --> 00:01:25,380 and this, of course 41 00:01:25,380 --> 00:01:27,240 I would say it's a bit more 42 00:01:27,240 --> 00:01:28,850 elegant and a bit nicer 43 00:01:28,850 --> 00:01:31,080 than using AuthContext Consumer, 44 00:01:31,080 --> 00:01:31,913 which you... 45 00:01:31,913 --> 00:01:34,110 However, just to make this clear, 46 00:01:34,110 --> 00:01:35,980 are always allowed to use. 47 00:01:35,980 --> 00:01:37,810 It's not wrong or anything like that. 48 00:01:37,810 --> 00:01:39,620 This is just a bit more elegant 49 00:01:39,620 --> 00:01:40,573 in my opinion. 3171

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