04.1.4 · Skill in Software development

State management

Keeping track of data and UI state so the interface stays consistent.

State management decides where data lives, how it changes and how the UI stays in sync with the server. Many bugs come from state stored in two places. Simple, explicit state makes features easier to change.

Your status · State management

Saved in this browser. Sign in to keep it on every device.It colours this skill's tile on your map.

Why it matters for a product engineer

State management decides where data lives, how it changes and how the interface stays in step with the server. Many bugs come from the same data stored in two places that disagree. Simple, explicit state makes features easier to change, and it decides what users see when the network is slow or gone.

How to do it

  1. List each piece of state and choose one owner for it: the URL, the component, the browser’s storage or the server.
  2. Keep state as close as possible to where it is used. Most state does not need to be global.
  3. Treat server data as a cache with rules: when to fetch it again, and what to show while it loads.
  4. Put state people share or bookmark, such as filters and tabs, in the URL.
  5. When the same data lives in two places, write the merge rule down before you write code.
  6. Test the hard cases: two tabs, offline, a slow request and a second device.

Common mistakes

  • Copying server data into global state and forgetting to update it.
  • One global store for everything, so any change can break anything.
  • No rule for conflicts, so the last request to arrive wins by accident.
  • Loading spinners for data the page already had.

Example

On this site, progress on the skills map works without an account. The page reads the browser’s copy. When someone signs in, each change also goes into a queue in the browser, which keeps it until the server confirms it, so changes made offline go out later. The server keeps the newest change for each skill, so an old laptop cannot overwrite newer work.

Side by side

Where progress lives on this site, and the rule for each place

Where it livesThe rule
What the page showsThe browser's copyWorks offline and without an account
Changes not yet savedA queue in the browserKept until the server confirms them
Progress across devicesThe account on the serverThe newest change for each skill wins
Visitors without an accountOnly the browserThe page never calls the server

Each place has one job and one written rule. The merge rule is per skill, so two devices rarely conflict at all.

Observedproductengineer.pro, the progress sync code and the API notes, Nov 2026

Sources: Application state management with React (Kent C. Dodds) ↗

Resources

1