Redux, Second Steps - abukhalil-LTUC-ASAC/amman-401d4 GitHub Wiki

Best of Redux

What made this a special day, is the ease of implementation, the additional setup tests could be confusing till gotten used to but this looks extremely scalable so far.

Interesting concepts include action creator, a function that contains an object to return, along with a dispatch in that object. It's not the action per se, just the function that contains it :). The other funny concept of time travel in redux, it is enabled by a dev tool for redux and enables the recording all the dispatched actions at that moment without reload or anything complicated.

Insights

Redux is really that much better at scale, I could not imagine using context api to handle different providers at many different levels. One of many pro's is the fact that changes are centralized to reducers, any dispatch changes, any initial state handling is all in a single place, and what components need to do is to simply connect to it. Want to hide a couple of random components all around but not anything else? Connect it to login state and check if its a valid login.

And because redux is readonly specified in the document with the nonmutable state, instead the changes happen in dispatch.

What's next? combineReducers is next!

This is what will handle our branching reducer functions into one when we set the providor. Simply use combineReducers and add in your reducer functions as key:value pairs inside, then use that contained reducer combination in createStore.