Frontend state gets difficult when it is unclear who owns a value or which parts of the interface depend on it. A useful starting point is to keep each piece of state as close as possible to the component that needs to change it.

Separate server data from interface choices

Fetched records and local choices such as an open menu have different lifecycles. Treating them separately makes loading, refreshing, and editing easier to reason about. Shared state is helpful when multiple parts of the page truly need the same source of truth; otherwise, passing a small value to a child can be simpler.

Name the waiting states

An asynchronous screen usually has more than “data” and “no data.” It may be loading, empty, ready, or showing an error. Representing these states deliberately prevents stale content from appearing as if it were current and gives the person using the page useful feedback.

Keep updates unsurprising

Prefer one clear owner for each value and update it through a small number of paths. When state transitions are easy to follow, debugging and review become easier too.