The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Redux: Refactoring the Reducers

Redux: Refactoring the Reducers

6:23
We will learn how to remove the duplication in our reducer files and how to keep the knowledge about the state shape colocated with the newly extracted reducers.
Watch this lesson now
Avatar
egghead.io

We will learn how to remove the duplication in our reducer files and how to keep the knowledge about the state shape colocated with the newly extracted reducers.

Avatar
Ben

looks like a given component (or container, or equivalent) could ultimately have its own reducer, doesn't it ?

Avatar
Dan Abramov

If your components map 1:1 to reducers, maybe you don’t need Redux, and could use Redux state model instead :-). In this tutorial, the structure of components doesn’t neatly map to the structure of reducers. This has benefits such as ensuring entities are never duplicated in the state, but it also means components do not “have” their own reducers.

In reply to Ben
Avatar
Puneeth

Here you mention we write the selector function in the same file as the reducer. But if we were to make use of selector library like reselect, should the selector functions be written in a separate file? What would be a good way to go about it?
Thanks

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?