Question presented to candidate:
"You wrap a state update in startTransition. What actually changes about how React renders it?"
What a strong answer should cover:
- A transition marks an update non-urgent. It does not make the work faster — it changes when and at what priority the work is done.
- The observable effect is a split: the urgent update commits on its own first, and the transition update commits in a second render.
- That second render is interruptible. If a new urgent update arrives while it is in progress, React abandons the partial work and starts over with the newer state.
- The old UI stays on screen while the transition renders — no fallback, no blank space, which is the difference from a plain Suspense boundary.
useTransitiongives you anisPendingboolean;startTransitionimported from React does not, and can be called outside a component.- Never wrap the controlled value of an input in a transition — the input must update urgently or typing feels broken.
- It changes priority, not cost. If a render takes 300ms it still takes 300ms; it just no longer blocks the keystroke.
Clarifying questions expected:
- "Which part of the update is the user waiting on directly?" — that part stays urgent.
- "Is the slowness the render itself, or fetching data?" — a transition helps the first, not the second.
Code / implementation expected: Optional. Showing which setState goes inside the transition and which stays outside is the substance.