When designing the Redux state, you should make sure that you keep the following in mind:
- Try not to duplicate data, as it becomes harder to ensure that all data is up to date and synchronized.
- Nested data means that the reducer logic has to be more nested or more complex. Ensure that each reducer only handles a certain kind of data, stored in its state subtree.
- Deeply nested data also brings performance issues--when our state updates, all ancestors in the state tree need to be copied and updated, and the new object references will cause connected components to re-render, even if the data hasn't actually changed.
To avoid most of these issues, you need to make sure that you design Redux state in a normalized way. The concepts ...