1 00:00:00,750 --> 00:00:03,590 OK it's the last couple of sections have been a total whirlwind. 2 00:00:03,600 --> 00:00:06,770 Let's take a minute step back and review what we've discussed. 3 00:00:06,780 --> 00:00:09,920 One more time and continue on. 4 00:00:09,930 --> 00:00:13,230 So first off a couple bullet points of review. 5 00:00:13,620 --> 00:00:18,840 Most important thing that I want to take away from this entire tutorial is that redux is in charge of 6 00:00:18,840 --> 00:00:27,430 managing our applications state and that state is a single plain javascript object. 7 00:00:27,540 --> 00:00:32,610 I do want to point out that our application state is completely different than a component state. 8 00:00:32,940 --> 00:00:39,450 So our components can still say stuff like you know this state DOT whatever and we can still do this 9 00:00:39,450 --> 00:00:44,160 dot set states something something something something right. 10 00:00:44,160 --> 00:00:46,700 Our components state is completely different. 11 00:00:46,700 --> 00:00:49,750 Completely separate from our application state. 12 00:00:49,790 --> 00:00:51,960 There's absolutely no tie whatsoever. 13 00:00:52,110 --> 00:00:54,350 And in reality we could have very easily. 14 00:00:54,420 --> 00:00:55,440 Well not you know you and I. 15 00:00:55,440 --> 00:00:59,620 Per se but the creators of redux could have easily called it something totally different. 16 00:00:59,620 --> 00:01:04,320 You're not state at all just to distinguish the two because they are not connected in any way shape 17 00:01:04,320 --> 00:01:07,350 or form. 18 00:01:08,370 --> 00:01:15,930 The next Sam honoree covered cover is our reducers remember our application state is formed by our reducers 19 00:01:17,550 --> 00:01:24,840 our reducers all get tied together with this combine reducers method inside of our reducers index file 20 00:01:24,840 --> 00:01:36,180 right here for each key in our combined reducers object we assign one reducer and that reducer is responsible 21 00:01:36,180 --> 00:01:38,510 for creating this piece of state. 22 00:01:38,610 --> 00:01:45,210 So whatever active book reduce returns will be available as our active book Peace of application state 23 00:01:45,210 --> 00:01:47,830 . 24 00:01:47,930 --> 00:01:54,900 The third thing I want to cover one more time is that our reducers are in charge of manipulating or 25 00:01:54,900 --> 00:01:58,000 excuse me changing our application state over time. 26 00:01:58,010 --> 00:02:00,970 And they do that through the use of actions. 27 00:02:01,350 --> 00:02:06,240 So whenever an action is dispatched it flows through all of the different reducers in our application 28 00:02:06,690 --> 00:02:13,170 and each producer has the option to return a different piece of state than the usual based on that type 29 00:02:13,170 --> 00:02:18,730 of action that was received in the next section we're going to do a much more. 30 00:02:18,830 --> 00:02:24,480 I would say real life example with reducers where we're not just returning a payload off an object we're 31 00:02:24,480 --> 00:02:30,810 going to actually start manipulating state in more complex ways shapes and forms. 32 00:02:30,810 --> 00:02:39,450 Finally we've covered actions and action creators action creators are just simple functions that return 33 00:02:39,540 --> 00:02:43,910 an action and an action is just a plain javascript object. 34 00:02:44,220 --> 00:02:51,240 Actions must always have a type defined and they can optionally have a payload or any other number of 35 00:02:51,240 --> 00:02:52,140 properties. 36 00:02:52,260 --> 00:02:57,660 But in general we tend to call this payload whenever we pass you know a piece of data along with the 37 00:02:57,660 --> 00:02:58,490 action. 38 00:02:58,500 --> 00:02:59,480 It's just convention. 39 00:02:59,490 --> 00:03:00,990 There's no requirement in redux. 40 00:03:00,990 --> 00:03:02,710 It's just convention. 41 00:03:03,480 --> 00:03:03,850 OK. 42 00:03:03,870 --> 00:03:06,740 So that's all the kind of the individual pieces. 43 00:03:06,960 --> 00:03:13,320 With that in mind I want to go over just one one last time our diagram here and how our application 44 00:03:13,320 --> 00:03:14,670 actually worked. 45 00:03:14,670 --> 00:03:21,190 So we tied an action creator to our book buttons over here the book list items. 46 00:03:21,390 --> 00:03:27,660 Whenever a user clicked on a book list item it called an action creator which dispatch star action. 47 00:03:27,810 --> 00:03:33,570 That action was automatically sent to all of our different reducers and for the reducers that cared 48 00:03:33,570 --> 00:03:34,880 about that particular action. 49 00:03:34,920 --> 00:03:37,610 In this case say books selected. 50 00:03:37,620 --> 00:03:45,560 They returned a piece of state which is assembled as the global application state and that global execute 51 00:03:45,630 --> 00:03:51,330 application state was then injected back into all the different containers inside of our application 52 00:03:51,330 --> 00:03:52,300 . 53 00:03:52,380 --> 00:03:55,930 The containers then re rendered and caused the dudes update. 54 00:03:56,310 --> 00:03:57,810 So that's really the big cycle. 55 00:03:57,840 --> 00:04:00,480 You know the cycle that all our redux app goes through. 56 00:04:00,750 --> 00:04:03,560 As long as you understand this cycle and even if you don't right now. 57 00:04:03,580 --> 00:04:09,750 You know don't sweat it don't take that as a you know negative comment or anything you will over time 58 00:04:09,750 --> 00:04:10,140 . 59 00:04:10,140 --> 00:04:16,080 As long as you get a grasp on this cycle you absolutely 100 percent will understand redux. 60 00:04:16,110 --> 00:04:21,000 It's really difficult to wrap your head around the first time but once you get it you're going to look 61 00:04:21,000 --> 00:04:26,280 back and say to yourself Wow this is actually pretty simple and that's why you see a lot of like posts 62 00:04:26,280 --> 00:04:30,870 online a lot of blog posts where people say oh yeah you know redux that's so simple. 63 00:04:30,990 --> 00:04:35,190 Well yeah it's simple but only simple once you actually understand what's going on. 64 00:04:35,190 --> 00:04:38,370 It's very challenging without a doubt to understand what's going on. 65 00:04:38,490 --> 00:04:42,830 But once you understand it it's simple to understand what everyone else feeling. 66 00:04:42,870 --> 00:04:45,420 Funny things like that right now. 67 00:04:45,570 --> 00:04:48,540 Anyways this has been our first application. 68 00:04:48,540 --> 00:04:53,910 I hope you enjoyed it and the next section we're going to start on a little bit more complicated application 69 00:04:53,910 --> 00:04:58,380 that starts to miss a little bit more real life circumstances and after that we're going to start to 70 00:04:58,380 --> 00:05:00,560 dive into even more complex applications. 71 00:05:00,570 --> 00:05:02,220 So I hope you stick around.