To wrap up, let us summarize the pros and cons of using Redux in a web application. First, let us start with the positives:
- Provides a certain project structure that allows us to easily extend and modify code later on
- Fewer possibilities for errors in our code
- Better performance than using React Context for state
- Makes the App component much simpler (offloads state management and action creators to Redux)
Redux is a perfect fit for larger projects that deal with complex state changes, and state that is used across many components.
However, there are also downsides to using Redux:
- Writing boilerplate code required
- Project structure becomes more complicated
- Redux requires a wrapper component (Provider) to connect the app to the store
As a result, Redux should not be used for simple projects. In these cases, a Reducer Hook might be enough. With a Reducer Hook...