All language subtitles for 003 Redux vs React Context_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,080 --> 00:00:04,530 So Redux is a state management system 2 00:00:04,530 --> 00:00:08,060 for cross-component or app-wide state as we learned. 3 00:00:08,060 --> 00:00:10,340 And of course we can then ask ourselves, 4 00:00:10,340 --> 00:00:13,830 but don't we have React Context for that already? 5 00:00:13,830 --> 00:00:16,530 React Context is a concept and a feature 6 00:00:16,530 --> 00:00:18,100 we already alerted about 7 00:00:18,100 --> 00:00:20,630 and which we already used a lot in this course 8 00:00:20,630 --> 00:00:24,240 because it also allows us to avoid prop chains 9 00:00:24,240 --> 00:00:28,110 or prop drilling, and instead we can have a central place 10 00:00:28,110 --> 00:00:31,070 our Context and the Context Provider component 11 00:00:31,070 --> 00:00:33,370 which we use for managing state. 12 00:00:33,370 --> 00:00:35,810 So why do we need Redux? 13 00:00:35,810 --> 00:00:40,300 React Context has a couple of potential disadvantages. 14 00:00:40,300 --> 00:00:43,990 And I say potential because they might not matter 15 00:00:43,990 --> 00:00:45,490 in the app you're building. 16 00:00:45,490 --> 00:00:47,990 And if they don't matter, you don't need Redux. 17 00:00:47,990 --> 00:00:49,730 It is as simple as that. 18 00:00:49,730 --> 00:00:53,060 And just as a side note, because it's all is important, 19 00:00:53,060 --> 00:00:56,810 it's also not an either or decision. 20 00:00:56,810 --> 00:01:00,130 You can also use both Contexts and Redux 21 00:01:00,130 --> 00:01:02,130 in the same application. 22 00:01:02,130 --> 00:01:04,230 Typically for application wide-state, 23 00:01:04,230 --> 00:01:06,280 you will only use one of the two, 24 00:01:06,280 --> 00:01:08,110 but then you could be using Redux 25 00:01:08,110 --> 00:01:10,800 for the general application wide-state 26 00:01:10,800 --> 00:01:15,800 and still use Context for selected multi-component states 27 00:01:16,690 --> 00:01:20,680 which are important in parts of your application. 28 00:01:20,680 --> 00:01:24,450 So mixing and matching like that would also be possible 29 00:01:24,450 --> 00:01:26,330 but let's not dive into that right now, 30 00:01:26,330 --> 00:01:29,260 let's instead focus on the disadvantages 31 00:01:29,260 --> 00:01:31,823 you could be facing with React Context. 32 00:01:32,720 --> 00:01:35,570 But what are these disadvantages then? 33 00:01:35,570 --> 00:01:40,370 One potential disadvantage is that with React Context, 34 00:01:40,370 --> 00:01:43,600 you can have a very complex setup 35 00:01:43,600 --> 00:01:46,520 and managing state with React Context 36 00:01:46,520 --> 00:01:49,240 can become quite complex. 37 00:01:49,240 --> 00:01:51,340 And that definitely depends 38 00:01:51,340 --> 00:01:53,830 on the kind of application you're building. 39 00:01:53,830 --> 00:01:57,570 For a lot of small or medium-sized applications 40 00:01:57,570 --> 00:02:00,580 that will very likely not be a problem. 41 00:02:00,580 --> 00:02:02,830 But if you're building a large application 42 00:02:02,830 --> 00:02:06,090 an enterprise level application with a lot of components 43 00:02:06,090 --> 00:02:08,120 and a lot of things going on, 44 00:02:08,120 --> 00:02:10,340 then when using React Context, 45 00:02:10,340 --> 00:02:13,600 you can end up with code like this. 46 00:02:13,600 --> 00:02:16,460 Where you have a lot of different pieces of Context, 47 00:02:16,460 --> 00:02:20,230 a lot of different States that affect multiple components 48 00:02:20,230 --> 00:02:22,620 or the entire app, and therefore 49 00:02:22,620 --> 00:02:25,310 a lot of different Context Provider components 50 00:02:25,310 --> 00:02:28,650 which you built for managing these states. 51 00:02:28,650 --> 00:02:32,300 And you can end up with deeply nested JSX code 52 00:02:32,300 --> 00:02:34,810 like this as a result. 53 00:02:34,810 --> 00:02:36,660 Of course you don't need to build 54 00:02:36,660 --> 00:02:39,200 a lot of different Context Providers though, 55 00:02:39,200 --> 00:02:41,920 you could just use one big Context 56 00:02:41,920 --> 00:02:44,580 and one Context Provider component 57 00:02:44,580 --> 00:02:46,970 for a managing the entire state 58 00:02:46,970 --> 00:02:51,480 and all the different kinds of state of your application. 59 00:02:51,480 --> 00:02:55,420 But that could lead in a large Context Provider component 60 00:02:55,420 --> 00:02:57,950 which manages a lot of different things, 61 00:02:57,950 --> 00:03:00,660 and therefore itself becomes quite difficult 62 00:03:00,660 --> 00:03:05,660 to maintain and manage because it's doing a lot of things. 63 00:03:05,730 --> 00:03:08,490 You might end up with a large Context 64 00:03:08,490 --> 00:03:13,090 that cares about authentication, theming, user input, 65 00:03:13,090 --> 00:03:15,110 if a modal should be displayed or not, 66 00:03:15,110 --> 00:03:17,760 and maybe a lot of other things as well. 67 00:03:17,760 --> 00:03:19,720 So, that could be a downside. 68 00:03:19,720 --> 00:03:22,410 And if you split it into multiple Contexts 69 00:03:22,410 --> 00:03:25,320 you might be back to this picture. 70 00:03:25,320 --> 00:03:27,330 So that can be a problem. 71 00:03:27,330 --> 00:03:30,350 And we haven't faced it thus far in the course 72 00:03:30,350 --> 00:03:33,480 because we definitely didn't build a large enterprise 73 00:03:33,480 --> 00:03:36,700 level application in this course at this point. 74 00:03:36,700 --> 00:03:39,890 But you can absolutely face this problem 75 00:03:39,890 --> 00:03:43,120 in real react projects you might be working on, 76 00:03:43,120 --> 00:03:46,700 and therefore this is one potential disadvantage. 77 00:03:46,700 --> 00:03:50,523 Another potential disadvantage could be performance. 78 00:03:51,490 --> 00:03:56,030 We have an official quote by a member of their React team, 79 00:03:56,030 --> 00:03:59,650 who basically says that the new Context, 80 00:03:59,650 --> 00:04:02,220 which is the Context you learn about in this course, 81 00:04:02,220 --> 00:04:06,340 the post is from 2018, end of 2018, 82 00:04:06,340 --> 00:04:09,650 but still that is exactly the Context we are using here 83 00:04:09,650 --> 00:04:12,520 that this Context which was introduced back then 84 00:04:12,520 --> 00:04:14,790 which is why to post is from that date, 85 00:04:14,790 --> 00:04:18,630 that this Context is great for low-frequency updates 86 00:04:18,630 --> 00:04:22,920 like changing a theme, or maybe also authentication, 87 00:04:22,920 --> 00:04:26,170 but it's not that great if your data changes a lot. 88 00:04:26,170 --> 00:04:28,310 For a high frequency changes, 89 00:04:28,310 --> 00:04:31,670 though it's not clear what exactly high-frequency means, 90 00:04:31,670 --> 00:04:35,460 but for changes that happen more frequently or often general 91 00:04:35,460 --> 00:04:38,040 that it's not that good for that. 92 00:04:38,040 --> 00:04:40,370 And this team member says that, 93 00:04:40,370 --> 00:04:44,160 therefore this new context is not ready 94 00:04:44,160 --> 00:04:47,930 as a replacement for flux like state propagation. 95 00:04:47,930 --> 00:04:49,700 Now this might not tell you much 96 00:04:49,700 --> 00:04:54,360 but Redux is a flux like state management library. 97 00:04:54,360 --> 00:04:56,680 So he says that React Context 98 00:04:56,680 --> 00:04:59,380 is not really a great replacement 99 00:04:59,380 --> 00:05:03,413 for Redux in all scenarios, in all cases. 100 00:05:04,830 --> 00:05:07,200 So therefore that's our second disadvantage, 101 00:05:07,200 --> 00:05:10,470 performance can be bad if you're managing 102 00:05:10,470 --> 00:05:14,300 the wrong kinds of state with React Context. 103 00:05:14,300 --> 00:05:16,300 Now, therefore to sum it up, 104 00:05:16,300 --> 00:05:19,870 we have the complex setup and management disadvantage 105 00:05:19,870 --> 00:05:23,690 because we may end up with deeply nested JSX code 106 00:05:23,690 --> 00:05:26,500 and a lot of different Context Providers 107 00:05:26,500 --> 00:05:30,860 or with one huge Context Provider which is not maintainable. 108 00:05:30,860 --> 00:05:33,790 On the other hand we have potential performance issues 109 00:05:33,790 --> 00:05:36,070 because we should not use React Context 110 00:05:36,070 --> 00:05:38,990 for high-frequency state changes. 111 00:05:38,990 --> 00:05:42,300 Now I will, again, emphasize that for small 112 00:05:42,300 --> 00:05:46,420 or medium-sized apps and even certainty a lot of big apps, 113 00:05:46,420 --> 00:05:48,620 this might all not matter, 114 00:05:48,620 --> 00:05:50,860 but of course my goal with the course here, 115 00:05:50,860 --> 00:05:53,700 is to teach you realistic React 116 00:05:53,700 --> 00:05:56,350 which you can apply to any kind of project. 117 00:05:56,350 --> 00:05:58,250 And therefore it is important 118 00:05:58,250 --> 00:06:02,090 to be aware of these limitations of React Context 119 00:06:02,090 --> 00:06:06,110 which could matter in the projects you are working on. 120 00:06:06,110 --> 00:06:08,560 And that's exactly why in this module 121 00:06:08,560 --> 00:06:12,180 we are learning about an alternative to React Context. 122 00:06:12,180 --> 00:06:14,130 We are learning about Redux 123 00:06:14,130 --> 00:06:17,333 which does not suffer from these disadvantages. 9967

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