1 00:00:00,750 --> 00:00:06,160 In last video we finish up our first example using context in place of redux to share information and 2 00:00:06,160 --> 00:00:08,590 cheering information inside of application. 3 00:00:08,770 --> 00:00:13,660 In this video I want to very quickly mention a couple of reasons that I recommend you continue to use 4 00:00:13,720 --> 00:00:16,900 redux in any serious application we plan to work on. 5 00:00:17,170 --> 00:00:19,750 So here's my big reasons with redux. 6 00:00:19,750 --> 00:00:22,000 We get some excellent documentation. 7 00:00:22,000 --> 00:00:26,620 I don't know if you've ever looked at the documentation for the redux library but it is pretty top notch. 8 00:00:26,650 --> 00:00:27,630 It is very well written. 9 00:00:27,640 --> 00:00:32,290 There are great examples and in general you can kind of understand exactly what's going on. 10 00:00:32,290 --> 00:00:38,710 In addition with redux there are extremely well known design patterns online there are dozens hundreds 11 00:00:38,710 --> 00:00:44,260 thousands of different tutorials that tell you exactly how to work with redox and how to handle a variety 12 00:00:44,260 --> 00:00:45,810 of different scenarios. 13 00:00:45,820 --> 00:00:51,070 In addition there are a tremendous number of open source libraries specifically made to help you work 14 00:00:51,070 --> 00:00:52,570 with redux. 15 00:00:52,570 --> 00:00:57,460 So these are all very good reasons to continue to use redux inside of any serious project you plan to 16 00:00:57,460 --> 00:00:58,390 work on. 17 00:00:58,390 --> 00:00:59,720 Why would we use context. 18 00:00:59,860 --> 00:01:05,230 Well with context we don't have to use an extra library and that's kind of like pretty much it. 19 00:01:05,230 --> 00:01:09,730 To be honest that's the only big benefit to using context in place of redux. 20 00:01:09,730 --> 00:01:12,430 We do not have to use a separate library. 21 00:01:12,430 --> 00:01:17,380 Now some of the challenges of context are that it's really hard to build one of these store components 22 00:01:17,590 --> 00:01:21,850 like the language store that we just saw that has cross-cutting concerns. 23 00:01:21,850 --> 00:01:28,600 In other words we would probably want to build a separate store component for each type of resource 24 00:01:28,600 --> 00:01:30,180 we have inside of our application. 25 00:01:30,190 --> 00:01:33,790 So for example if we have languages we would have a language store. 26 00:01:34,300 --> 00:01:38,460 If we plan to have authentication we might want to create a user store or something like that. 27 00:01:38,650 --> 00:01:43,810 And these would probably all be separate reac components sharing data between these different stores 28 00:01:43,840 --> 00:01:45,410 would be really challenging. 29 00:01:45,700 --> 00:01:51,040 So I want you to remember back to one of the applications we worked on the streaming application. 30 00:01:51,280 --> 00:01:55,940 So here is the code for the streaming application I've got it up inside of my code editor right here. 31 00:01:56,170 --> 00:01:59,590 And here's an action critter that we put together to create a new stream. 32 00:01:59,590 --> 00:02:05,260 Remember we had said that when we created a stream we wanted to associate the user idea of the currently 33 00:02:05,260 --> 00:02:07,680 authenticated user with the stream that was created. 34 00:02:07,870 --> 00:02:13,420 So inside of a single action creator we were able to reach in to our entire state object get access 35 00:02:13,420 --> 00:02:19,450 to all the data inside of redux and use it to essentially associate the current user ID with this newly 36 00:02:19,450 --> 00:02:21,470 created stream. 37 00:02:21,520 --> 00:02:26,590 So inside of a single action creator we could get access to all of the data of our entire application 38 00:02:27,160 --> 00:02:32,640 doing that same thing inside of one of these store components would be far far more challenging. 39 00:02:32,770 --> 00:02:37,180 We would have to make sure that we called any callback like this right here with all the appropriate 40 00:02:37,210 --> 00:02:38,080 arguments. 41 00:02:38,080 --> 00:02:43,480 So essentially inside of some component if we wanted to associate a language with say like a user ID 42 00:02:43,480 --> 00:02:48,640 for some crazy reason we would have to call this callback function with the language and the user id 43 00:02:49,000 --> 00:02:54,160 it would be really hard to write some code inside of year that reached into another store of data and 44 00:02:54,160 --> 00:02:55,590 pulled some data out of it. 45 00:02:55,600 --> 00:03:00,160 So thats definitely a really big challenge with this approach and one that I'm not sure people have 46 00:03:00,160 --> 00:03:04,780 done a lot of research on to figure out a best approach of dealing with it. 47 00:03:04,870 --> 00:03:05,280 All right. 48 00:03:05,290 --> 00:03:08,180 So there are good reasons to use context. 49 00:03:08,170 --> 00:03:10,430 You know theres a little bit less code we have to write yeah. 50 00:03:10,450 --> 00:03:14,770 We didn't have to use that extra library but at the end of the day I think that personally it makes 51 00:03:14,770 --> 00:03:19,380 a lot of sense to continue to use redux for any serious application we plan to work on. 52 00:03:19,660 --> 00:03:24,310 So once again I want to throw this video in here just to get you thinking about some things and help 53 00:03:24,310 --> 00:03:27,510 you understand it just know that hey we're still using redux right. 54 00:03:27,510 --> 00:03:28,680 We're still in a redux world. 55 00:03:28,690 --> 00:03:33,580 It is still an extremely popular library and just because context exists doesn't mean that redux is 56 00:03:33,580 --> 00:03:36,740 just going to suddenly die out or anything like that. 57 00:03:37,790 --> 00:03:40,790 All right let's take a pause right here and we'll continue in the next video.