State and effects¶
Choose the state owner¶
| State kind | Typical owner |
|---|---|
| Input draft | Form component |
| Shared workflow | Nearest common route/layout |
| Shareable filter | URL |
| Domain transitions | Focused reducer/provider |
| Remote records | Server-state cache/repository |
Store the minimum source facts and derive the rest during render.
Effect decision test¶
- Is React rendering enough to calculate the value? Calculate it.
- Did a user event cause the action? Handle it in the event.
- Must committed UI synchronize with a network, timer, subscription, DOM API, or third-party widget? Use an effect with symmetric cleanup.
Dependencies describe every reactive value read by effect setup. They are not a manual scheduling preference.