Controlling state with reducers
The flagship concept of Redux is that, state is controlled by reducer functions. In this section, we'll get you caught up on what reducers are, followed by the implementation of reducer functions in your Snapterest app.
What are reducers?
Reducers are functions that take a data collection, such as an object or an array, and return a new collection. The returned collection can have the same data in it, or it can have completely different data than the initial collection. In Redux applications, reducer functions take a slice of state, and return a new slice of state. That's it! You've just learned the crux of the Redux architecture. Now let's see reducer functions in action.
Reducer functions in Redux applications can be separated into modules that represent the part of the application state they work with. We'll look at the collection reducers, followed by the tweet reducers of the Snapterest app.
Collection reducers
Now let's walk...