Thoughts On You Might Not Need Redux
Recently someone asked me:
When I use React I have a lot of props going up and down the tree of components. How do you avoid that?
The answer the other developer was looking for was “use Redux”, which is true to an extent. Redux can be extremely helpful for managing state and knowing where one’s state is at all times. For React, and any functional programming endeavor, keep one’s eye on state and everything will be alright.
However, jumping to Redux right away is not always the best choice. Redux can be used without React and React exists as a standalone library, not built just for Redux. Dan Abramov, one of the main creators of React and Redux wrote an article about how, well, you just might not need Redux. The article discusses a lot of reasons why a plan React app, without Redux, could be what is needed to get the job done, with great reasoning behind everything.
The article lists three reasons constraints, or tradeoffs, with Redux:
- Describe application state as plain objects and arrays.
- Describe changes in the system as plain objects.
- Describe the logic for handling changes as pure functions.
In three subsequent blog posts I’ll talk about my experience with each and why they are important.
