...

/

Reducer Nesting and Coupling

Reducer Nesting and Coupling

Here we pass action through multiple reducers and discuss the best approach to nesting.

We'll cover the following...

Let’s try to implement a reducer that adds a new ingredient to a recipe. There are two main approaches:

  • All the reducers in the chain are aware when the action is passed.
  • Each reducer only passes the information down to its children.

We can implement the first approach as follows:

const booksReducer = (state, action) => {
  switch (action.type) {
    case
...