The toughest thing to get right is state management. Unfortunately that's a lesson we learned over time, and without good planning you can lose your sanity.
Luckily, Redux/React is so good at abstracting away typical frontend work that we only need to focus on how to manage state.
Isn't redux meant to solve state issues?
Yes. Kind of. Well, not really. Redux is a suite to manage state. It gives you a global state store; a connector to pass state into components; middleware; and actions.
It does not give you any rules for structuring your state. Or for requesting data from the server within nested components. Or for managing UI state across unrelated components.
These are the core state issues that you'll to run in to when building apps:
- Syncing data with the server
- Tracking AJAX request statuses
- Deduping actions within child components
- Cache invalidation
- Universal apps
- Transforming state per component
- UI state
We tackle each of these problems in the following subchapters.