Full answer
Not every state update deserves the same urgency. Typing in a search box must feel instant, while re-rendering a long result list below it can wait a moment. React 18 introduced transitions to express this.
const [isPending, startTransition] = useTransition() returns a function. Updates inside startTransition(() => setTab('reports')) are marked as a transition. React renders them in the background and can interrupt that render if a more urgent update (such as a keystroke) arrives. While waiting, isPending is true, so you can dim the old content. In React 19, a transition can also contain async functions, which is how actions are tracked.
useDeferredValue(value) returns a copy of the value that may lag behind. React first renders with the old copy, so the urgent part (the input) updates at once, then re-renders with the new copy in the background. Use it when the slow component receives the value as a prop and you cannot wrap the setter. It is like debouncing without a fixed delay, and it adapts to the speed of the device.
How do you choose? If you own the state update, use useTransition. If the value arrives from somewhere else, or you want a lagging value for one subtree, use useDeferredValue. Both rely on the slow work being a normal React render. They do not help with a slow network call or a long script outside React. To make renders cheaper in the first place, memoize the slow list or reduce its size.
Transitions have rules: the setter called inside must be the React state setter, text input updates should not be wrapped in a transition (input state must stay urgent), and a transition that suspends keeps the old UI instead of the fallback.
The example filters 2000 names with a deferred query and switches a tab through a transition.
import { memo, useDeferredValue, useState, useTransition } from 'react';
const names = Array.from({ length: 2000 }, (_, i) => 'Student ' + i);
const ResultList = memo(function ResultList({ query }) {
const matches = names.filter((name) => name.includes(query));
return <p>{matches.length} matches</p>;
});
export default function SearchPage() {
const [query, setQuery] = useState('');
const deferredQuery = useDeferredValue(query);
const [tab, setTab] = useState('students');
const [isPending, startTransition] = useTransition();
return (
<div>
<input value={query} onChange={(e) => setQuery(e.target.value)} placeholder="Search" />
<ResultList query={deferredQuery} />
<button onClick={() => startTransition(() => setTab('reports'))}>Open reports</button>
<p>
Tab: {tab} {isPending ? '(loading)' : ''}
</p>
</div>
);
}The input updates immediately while ResultList renders with the deferred query. The check typed Asha, which matches none of the names. The tab update runs inside a transition. Rendered result: <div><input placeholder="Search" value="Asha"><p>0 matches</p><button>Open reports</button><p>Tab: reports </p></div>
Key points
- Both mark updates as non-urgent so urgent input updates stay responsive.
- useTransition wraps an update you control and gives isPending.
- useDeferredValue defers a value you receive and returns a lagging copy.
- They do not speed up slow code. They only prevent blocking.
- Do not put controlled input updates inside a transition.
Common mistakes
- Wrapping a controlled input's setter in startTransition, which makes typing lag.
- Expecting useDeferredValue to speed up a slow render. It only prioritizes.
- Using transitions for work that is slow outside React, such as a long synchronous script.
- Forgetting memo on the slow child, so it re-renders with the urgent value anyway.
Follow-ups
- How does a transition interact with Suspense?
- Why is useDeferredValue called an adaptive debounce?
- How would you show a pending indicator while the deferred value is behind?
Tips
- Start from the user experience (typing must stay instant), then name the hooks.
- Know the choice rule: setter you own versus value you receive.
- Say that memoizing the slow child is part of making useDeferredValue work.