State basics, local vs global state, and when state should be used
React state stores data that changes over time and affects rendering, but not everything in a component needs to become state.
- Use state for data that drives UI
- Keep state local when possible
- Do not store what can be derived cheaply
State basics, local vs global state, and when state should be used