All language subtitles for 018 React Context Limitations_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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,557 --> 00:00:04,470 [Maximilian Schwarzm�ller] So React Context is great. 2 00:00:04,470 --> 00:00:06,280 Let's use it for everything. 3 00:00:06,280 --> 00:00:07,980 Well, not quite. 4 00:00:07,980 --> 00:00:10,540 For one, keep in mind what I mentioned earlier. 5 00:00:10,540 --> 00:00:14,270 It can be great for app-wide or component-wide state. 6 00:00:14,270 --> 00:00:17,590 So essentially states that affects multiple components. 7 00:00:17,590 --> 00:00:21,460 It's not a replacement for component configuration. 8 00:00:21,460 --> 00:00:24,780 Consider our button here in the UI folder. 9 00:00:24,780 --> 00:00:26,800 The button should be reusable. 10 00:00:26,800 --> 00:00:30,720 Sure, we could use Context to make sure that upon a click 11 00:00:30,720 --> 00:00:32,689 we always logged the user out, 12 00:00:32,689 --> 00:00:35,280 but that would mean that we can't use the button 13 00:00:35,280 --> 00:00:38,300 for anything else than logging users out. 14 00:00:38,300 --> 00:00:40,070 And that might not be what you want. 15 00:00:40,070 --> 00:00:41,870 For example, in this application, 16 00:00:41,870 --> 00:00:44,040 we are using the same button component 17 00:00:44,040 --> 00:00:47,750 in the log in component to log the user in 18 00:00:47,750 --> 00:00:50,060 and triggered the form submission 19 00:00:50,060 --> 00:00:52,780 as well as we're using it in the home component 20 00:00:52,780 --> 00:00:54,860 to log the user out. 21 00:00:54,860 --> 00:00:58,300 So that is a scenario where using Context 22 00:00:58,300 --> 00:01:00,310 in the button component would be bad. 23 00:01:00,310 --> 00:01:03,550 You wanna use props here to configure the button. 24 00:01:03,550 --> 00:01:08,400 So props for configuration, context for state management 25 00:01:08,400 --> 00:01:12,380 across components or possibly across the entire app. 26 00:01:12,380 --> 00:01:14,910 But even then we have limitations, 27 00:01:14,910 --> 00:01:18,750 React Context is specifically not optimized 28 00:01:18,750 --> 00:01:21,470 for high frequency changes. 29 00:01:21,470 --> 00:01:24,950 So that means, for example, if you have state changes 30 00:01:24,950 --> 00:01:28,140 every second or multiple times per second, 31 00:01:28,140 --> 00:01:31,200 this is clearly not the case in our example here 32 00:01:31,200 --> 00:01:32,680 for authentication. 33 00:01:32,680 --> 00:01:34,250 That does not change that often, 34 00:01:34,250 --> 00:01:37,850 it changes once every few minutes in reality, 35 00:01:37,850 --> 00:01:39,170 maybe not even that. 36 00:01:39,170 --> 00:01:41,840 So that is a perfect use case for Context. 37 00:01:41,840 --> 00:01:43,530 But if you had state changes 38 00:01:43,530 --> 00:01:45,720 that happen much more frequently, 39 00:01:45,720 --> 00:01:49,520 again, talking about multiple changes per second and so on, 40 00:01:49,520 --> 00:01:53,480 then React Context is not optimized for that 41 00:01:53,480 --> 00:01:55,210 and you don't have to take this for me. 42 00:01:55,210 --> 00:01:57,110 This is actually something that was stated 43 00:01:57,110 --> 00:02:00,020 by the official React team member. 44 00:02:00,020 --> 00:02:04,230 So it's not great for high-frequency changes. 45 00:02:04,230 --> 00:02:07,527 Now, you might wonder, "Okay, but what if I have app-wide 46 00:02:07,527 --> 00:02:10,560 "or a component-wide state that changes often?" 47 00:02:10,560 --> 00:02:13,020 I would want to use Context for that. 48 00:02:13,020 --> 00:02:14,530 Props might not be ideal, 49 00:02:14,530 --> 00:02:16,740 and you're telling me that it's bad. 50 00:02:16,740 --> 00:02:18,670 We'll explore a better tool for that later. 51 00:02:18,670 --> 00:02:19,503 No worries. 52 00:02:19,503 --> 00:02:23,240 It will be called Redux and I'll have a whole section on it. 53 00:02:23,240 --> 00:02:25,480 And as I mentioned, it should not be used 54 00:02:25,480 --> 00:02:28,560 to replace all component communications on props. 55 00:02:28,560 --> 00:02:31,810 Props are still vital and important 56 00:02:31,810 --> 00:02:34,700 for component configuration. 57 00:02:34,700 --> 00:02:36,730 So you should still use props for that 58 00:02:36,730 --> 00:02:39,210 and not use Context for everything. 59 00:02:39,210 --> 00:02:41,760 For replacing long prop chains 60 00:02:41,760 --> 00:02:43,723 it might however be worth the look. 4704

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