Skip to content
Tutorials Center
My learning

Topics

React Reference ยท Performance and Concurrency Hooks

React useTransition hook

Reference for React useTransition: mark state updates as non-urgent, read isPending, and run async actions in a transition so the UI stays responsive.

useTransition lets you mark some state updates as transitions: work that may take a while and must not freeze the page. Urgent updates (typing, clicking) are handled first; a transition renders in the background and can be interrupted by newer input. While it is running, isPending is true, so you can show a hint without hiding what the user already sees.

Since React 19, the function you pass to startTransition can be async. React keeps isPending true until it finishes, which makes transitions the standard way to run an "action" such as a save.

JSX
const [isPending, startTransition] = useTransition();
startTransition(() => setTab('posts'));

Try it

An async action with isPending
Keeping the old tab while a slow one renders

When you click "Slow list", the welcome text stays visible and dims until the new tab is ready, and the buttons keep responding.

Syntax

JSX
const [isPending, startTransition] = useTransition();
startTransition(action);
Name Description
action A function that sets state. It may be async; in that case React tracks the returned promise.

Returns: an array of exactly two items: isPending (boolean) and startTransition (a stable function). startTransition returns nothing.

Edge cases: state updates made after an await inside an async action are no longer marked as transition updates; wrap them in another startTransition as in the first example.

Usage notes

  • Only for state you own. A transition marks set calls made synchronously inside the function. It cannot control a controlled text input: typing must stay urgent, so use useDeferredValue for search-as-you-type.
  • Interruptible. If another transition starts, React may abandon the old one; only the latest result is committed.
  • Suspense friendly. A transition that suspends keeps the old UI instead of showing a fallback; see How Suspense works.
  • Errors thrown in the action reach the nearest error boundary.
  • Updates in the same transition are batched and committed together.
  • startTransition without the hook exists as a top-level export for places where you do not need isPending: startTransition.
  • Not a speed-up. It changes priority, not total cost. Slow components are still slow; consider memoization.
  • Calling startTransition while rendering is not allowed.