Manage component state

Manage component state in JavaScript — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
I need to wire a component so its UI stays in sync with user input and an async load. Update the…
I need to wire a component so its UI stays in sync with user input and an async load. Update the component state when the text input changes and when the fetch returns; prevent state updates after the component unmounts. After wiring, verify that typing reflects immediately and that the loaded data replaces the placeholder without causing errors.

Improve — make it easier to accept

+
Before I commit this component, make the state handling easier for a reviewer: surface where local…
Before I commit this component, make the state handling easier for a reviewer: surface where local state lives, show which fields are derived vs source-of-truth, highlight any direct DOM reads or shared-mutable objects that could confuse updates, and flag code paths that might set state after unmount.

Decide — diagnose the stuck moment

+
I just saw a warning that state was updated after the component unmounted. The component fetches…

User types quickly then navigates away and I still get a setState warning

I just saw a warning that state was updated after the component unmounted. The component fetches profile data on mount and binds onChange for an input; Alice on QA left the page fast. I don't know whether the fetch or the input callback caused it, and I can't reproduce reliably. What is the most likely cause and the smallest change to reliably stop the warning while preserving behavior?

Become — change the pattern

+
Across several features we keep getting state-update-after-unmount warnings and duplicated state…

setState warnings and spaghetti state across multiple components

Across several features we keep getting state-update-after-unmount warnings and duplicated state for the same entity in parent and child components. Each fix is ad hoc and we regress. Help me pick one habit to change that reduces these bugs and speeds reviews. Explain the habit and a concrete first PR-size change I can make.

Next to this one

Other programming language work people do in JavaScript.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.