All language subtitles for 016 Redux Challenges & Introducing Redux Toolkit_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,290 --> 00:00:04,230 So by now we learned a lot 2 00:00:04,230 --> 00:00:09,010 about the important basics of Redux and how we use it. 3 00:00:09,010 --> 00:00:12,562 Now the more complex our projects become 4 00:00:12,562 --> 00:00:17,460 the more complex it can get to use Redux correctly. 5 00:00:17,460 --> 00:00:19,410 Now the good thing is that in this course 6 00:00:19,410 --> 00:00:22,680 you will of course see many examples also bigger projects 7 00:00:22,680 --> 00:00:25,460 than this one but another good news 8 00:00:25,460 --> 00:00:28,950 is that there is a slightly easier way 9 00:00:28,950 --> 00:00:31,220 of using Redux as well. 10 00:00:31,220 --> 00:00:35,160 Now I wanted to show you the core foundation first 11 00:00:35,160 --> 00:00:37,260 so that you understand how it works 12 00:00:37,260 --> 00:00:39,760 but now I want to dive into an approach 13 00:00:39,760 --> 00:00:43,280 that's a bit easier to set up and maintain. 14 00:00:43,280 --> 00:00:46,006 Before we do that though, let's identify a couple 15 00:00:46,006 --> 00:00:49,400 of potential problems we could be facing here 16 00:00:49,400 --> 00:00:52,540 if our application would continue to grow. 17 00:00:52,540 --> 00:00:57,060 So if we manage more and more state with Redux. 18 00:00:57,060 --> 00:01:00,930 One potential issue can be our action types. 19 00:01:00,930 --> 00:01:04,550 These identifiers, I mentioned it before, 20 00:01:04,550 --> 00:01:07,530 you of course have to avoid typos. 21 00:01:07,530 --> 00:01:10,610 If you dispatch an action, you have to make sure 22 00:01:10,610 --> 00:01:14,220 that you don't mistype the identifier here 23 00:01:14,220 --> 00:01:17,730 otherwise it of course won't be handled by the reducer 24 00:01:17,730 --> 00:01:20,460 or won't be handled correctly. 25 00:01:20,460 --> 00:01:23,760 Now that's not a problem in a small app like this 26 00:01:23,760 --> 00:01:27,350 but in bigger applications with a lot of developers working 27 00:01:27,350 --> 00:01:30,100 on the app and with a lot of different actions 28 00:01:30,100 --> 00:01:31,660 it's super easy to imagine 29 00:01:31,660 --> 00:01:34,250 that you could mess up one of these identifiers. 30 00:01:34,250 --> 00:01:37,610 You could even have clashing identifiers there 31 00:01:37,610 --> 00:01:40,060 so clashing identifier names. 32 00:01:40,060 --> 00:01:42,180 So therefore having some way 33 00:01:42,180 --> 00:01:45,250 of defining those identifiers once 34 00:01:45,250 --> 00:01:48,370 and then reusing them would be nice. 35 00:01:48,370 --> 00:01:50,910 And that is something we can do with JavaScript 36 00:01:50,910 --> 00:01:54,040 and something I will come back to in a second. 37 00:01:54,040 --> 00:01:57,010 Another potential problem is the amount 38 00:01:57,010 --> 00:01:59,130 of data which we manage here. 39 00:01:59,130 --> 00:02:02,340 The more data we have the more different pieces 40 00:02:02,340 --> 00:02:07,020 of state we have, the bigger our state objects get. 41 00:02:07,020 --> 00:02:10,330 And that means that we need to copy a lot of state 42 00:02:10,330 --> 00:02:13,230 when we update the counter we still need to copy 43 00:02:13,230 --> 00:02:16,780 and keep all the other state properties, 44 00:02:16,780 --> 00:02:20,050 and it also means that this reducer function gets longer 45 00:02:20,050 --> 00:02:22,040 and longer and all of a sudden 46 00:02:22,040 --> 00:02:26,090 we might have an unmaintainable big Redux file. 47 00:02:26,090 --> 00:02:29,580 And you might recall that I brought this up 48 00:02:29,580 --> 00:02:33,860 as one potential disadvantage of React Context. 49 00:02:33,860 --> 00:02:37,800 If we put everything into one context provider file. 50 00:02:37,800 --> 00:02:40,900 Now we can end up with the same problem with the Redux 51 00:02:40,900 --> 00:02:44,503 but thankfully there are solutions for that with Redux. 52 00:02:45,493 --> 00:02:48,550 Another potential problem we could be facing 53 00:02:48,550 --> 00:02:53,480 is the state immutability which we have to respect. 54 00:02:53,480 --> 00:02:55,610 I talked about it in the last lecture. 55 00:02:55,610 --> 00:02:57,530 We have to ensure that we always return 56 00:02:57,530 --> 00:02:59,550 a brand new state snapshot 57 00:02:59,550 --> 00:03:01,780 and that we don't accidentally change 58 00:03:01,780 --> 00:03:03,830 the existing state anywhere. 59 00:03:03,830 --> 00:03:06,730 And especially if you have more complex data 60 00:03:06,730 --> 00:03:10,550 with nested objects and arrays it's easy to mess this up 61 00:03:10,550 --> 00:03:12,970 and accidentally change some nested data 62 00:03:12,970 --> 00:03:15,300 even though you didn't want to. 63 00:03:15,300 --> 00:03:16,790 So it would be great if we would have 64 00:03:16,790 --> 00:03:18,690 some help with that as well. 65 00:03:18,690 --> 00:03:20,990 And if we could ensure that we don't accidentally 66 00:03:20,990 --> 00:03:25,010 manipulate nested data or anything like that. 67 00:03:25,010 --> 00:03:28,220 Now for all those problems there are solutions 68 00:03:28,220 --> 00:03:30,050 we could implement on our own. 69 00:03:30,050 --> 00:03:33,960 For example, for ensuring that we have unique identifiers 70 00:03:33,960 --> 00:03:37,740 and we don't miss type we could create constants, 71 00:03:37,740 --> 00:03:39,750 let's say a constant named increments 72 00:03:39,750 --> 00:03:42,150 which stores this identifier, 73 00:03:42,150 --> 00:03:44,420 and we then export this constant 74 00:03:44,420 --> 00:03:49,110 and we check that constants value here and we then import 75 00:03:49,110 --> 00:03:52,010 and use that constant in the counter component 76 00:03:52,010 --> 00:03:56,130 so that here we use the type increment 77 00:03:56,130 --> 00:03:58,850 and we just import increments. 78 00:03:58,850 --> 00:04:03,850 So we import increment from going up store index. 79 00:04:06,800 --> 00:04:10,220 That is something we could do to fix this issue. 80 00:04:10,220 --> 00:04:13,260 And these are approaches which we typically used 81 00:04:13,260 --> 00:04:16,029 in the past with Redux. 82 00:04:16,029 --> 00:04:19,720 There also are solutions for splitting your reducer 83 00:04:19,720 --> 00:04:22,370 into multiple smaller reducers 84 00:04:22,370 --> 00:04:26,000 so that you don't get this large super big file, 85 00:04:26,000 --> 00:04:29,950 and there also our solutions and third-party packages 86 00:04:29,950 --> 00:04:33,470 which allow you to automatically copy state 87 00:04:33,470 --> 00:04:36,393 and ensure that you don't accidentally edit it. 88 00:04:37,230 --> 00:04:39,290 But we actually don't need to dive 89 00:04:39,290 --> 00:04:42,460 into those various solutions anymore. 90 00:04:42,460 --> 00:04:46,900 Instead there is another library called Redux Toolkit. 91 00:04:46,900 --> 00:04:48,940 And you can just Google for Redux Toolkit 92 00:04:48,940 --> 00:04:51,040 to find its official page. 93 00:04:51,040 --> 00:04:54,270 It's actually developed by the same person 94 00:04:54,270 --> 00:04:58,480 or the same team as React Redux and Redux itself 95 00:04:58,480 --> 00:05:01,660 and Redux Toolkit simply as an extra package 96 00:05:01,660 --> 00:05:06,660 which makes working with Redux more convenient and easier. 97 00:05:06,830 --> 00:05:10,860 You don't have to use it, unlike Redux and react Redux 98 00:05:10,860 --> 00:05:13,840 which we installed before, you don't have to install 99 00:05:13,840 --> 00:05:16,860 and use Redux toolkit but if you use it, 100 00:05:16,860 --> 00:05:19,630 certain things will get easier. 101 00:05:19,630 --> 00:05:22,260 And therefore, in the next lecture 102 00:05:22,260 --> 00:05:25,133 we're going to get started with Redux Toolkit. 8287

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