There is three principal of Redux.
- Single source of truth.
- The state is read-only.
- Changes are made with pure functions.
Why use Redux?
- Server-Side Rendering
- One Store / Multiple Reducers
- Easy to Migrate
- Developer Friendly
Benefits Of Redux
- Predictability of outcome
- There is always one source of truth, the store, with no confusion about how to sync the current state with actions and other parts of the application.
- Having a predictable outcome and strict structure makes the code easier to maintain.
- Redux is stricter about how code should be organized, which makes the code more consistent and easier for a team to work with.
- Server rendering
- This is very useful, especially for the initial render, making for a better user experience or search engine optimization. Just pass the store created on the server to the client side.
- Developer tools
- Developers can track everything going on in the app in real time, from actions to state changes.
- Community and ecosystem
- This is a huge plus whenever you’re learning or using any library or framework. Having a community behind Redux makes it even more appealing to use.
- Ease of testing
- The first rule of writing testable code is to write small functions that do only one thing and that are independent. Redux code is mostly functions that are just that: small, pure and isolated.