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