Both mark work as non-urgent so React's concurrent renderer can keep the UI responsive: urgent updates (typing, clicking) render first, and the non-urgent render happens in the background, can be interrupted, and is discarded if newer input arrives. useTransition gives you [isPending, startTransition] to wrap state updates you control (including async Actions in React 19). useDeferredValue(value) gives you a lagging copy of a value you may not control (a prop, or state from elsewhere), which re-renders with the new value at low priority. Neither debounces or makes code faster. They change scheduling priority.
function TabContainer() {
const [tab, setTab] = useState('about');
const [isPending, startTransition] = useTransition();
function selectTab(next) {
startTransition(() => {
setTab(next); // the expensive tab renders in the background
});
}
return (
<>
<TabButtons onSelect={selectTab} pendingTab={isPending ? tab : null} />
<div style={{ opacity: isPending ? 0.6 : 1 }}>
{tab === 'posts' ? <SlowPosts /> : <About />}
</div>
</>
);
}
SlowPosts is rendering interrupts it. The UI never freezes.startTransition accepts async functions (Actions). isPending stays true until they finish. Updates after an await must be wrapped in another startTransition.startTransition import works where hooks aren't available, but provides no isPending.function Search() {
const [query, setQuery] = useState('');
const deferredQuery = useDeferredValue(query);
const isStale = query !== deferredQuery;
return (
<>
<input value={query} onChange={e => setQuery(e.target.value)} />
<div style={{ opacity: isStale ? 0.6 : 1 }}>
<SlowResults query={deferredQuery} /> {/* wrap in memo so urgent renders skip it */}
</div>
</>
);
}
On each keystroke React first renders with the old deferredQuery (the input updates instantly), then attempts a background render with the new value. SlowResults should be memoized (memo, or the React Compiler), otherwise the urgent render re-renders it anyway and you gain nothing.
React 19 added an initialValue argument: useDeferredValue(value, initialValue) renders the initial value first (useful for showing a cheap placeholder on mount), then the real value in the background.
Use useTransition when… | Use useDeferredValue when… |
|---|---|
| You own the state update | You receive the value (props, a library hook) |
You want isPending for a specific action | You want to show stale content while fresh content renders |
| Navigation, tab switches, async Actions | Filtering or search results, charts driven by input |
isPending for unrelated UI. It's per hook instance.useTransition wraps updates you own (async Actions in 19). useDeferredValue wraps values (with initialValue in 19).Spotted a mistake or a rights concern? Report an issue