Skip to main content

useDeferredValue and stale UI

useDeferredValue lets one part of the UI lag behind the latest value.

import { useDeferredValue, useState } from 'react';

function SearchPage() {
const [query, setQuery] = useState('');
const deferredQuery = useDeferredValue(query);

return (
<>
<input
value={query}
onChange={(event) => setQuery(event.target.value)}
/>
<SearchResults query={deferredQuery} />
</>
);
}
Latest value and deferred value have different jobs
CANONICAL / URGENTLatest value

What the input and immediate UI need now.

PRESENTATION MAY LAGDeferred value

What slower or suspending UI may temporarily keep using.

How the catch-up render worksโ€‹

Suppose query changes from react to reacts.

1query = react
2User types s
3Urgent render: query = reacts, deferredQuery = react
4Background catch-up render begins
5deferredQuery = reacts commits when ready

The canonical value updates immediately. The dependent subtree is allowed to catch up in background work.

Background rendering is interruptibleโ€‹

If the user keeps typing, React can abandon an obsolete deferred render and restart toward the latest value.

Deferred work follows the latest intent, not every intermediate frame
Background render for r
Old render becomes obsolete
Background render for re
Slow UI catches up

There is no fixed delayโ€‹

useDeferredValue is not a debounce. React does not wait a fixed 200ms or 500ms timer. It starts background rendering after urgent work and can interrupt that render when more urgent work arrives.

It does not debounce requestsโ€‹

const deferredQuery = useDeferredValue(query);

This does not guarantee fewer network requests. If your data layer starts a request for every query value, you may still get one request per keystroke.

Rendering priority and request frequency are separate concerns
useDeferredValue
Controls React presentation priority.
Debounce / cache / cancel / dedupe
Controls request timing and network work.

Stale content with Suspenseโ€‹

const deferredQuery = useDeferredValue(query);
const isStale = query !== deferredQuery;

return (
<Suspense fallback={<ResultsSkeleton />}>
<div style={{ opacity: isStale ? 0.5 : 1 }}>
<SearchResults query={deferredQuery} />
</div>
</Suspense>
);
First load and later updates can have different UX
First load
No useful previous results exist โ†’ fallback may appear.
Later update
Old deferred results stay visible while fresh results prepare.

Stale UI should be communicated through dimming, aria-busy, subtle progress, or another appropriate indicator.

initialValueโ€‹

Current React supports an optional initial value:

const deferredValue = useDeferredValue(value, initialValue);

If supplied, initialValue can be used during the initial render before React catches up in the background. Without it, the initial render uses value because there is no previous version to preserve.

Use this carefully: an inappropriate initial value can briefly represent UI that never existed as canonical state.

Stable value identity mattersโ€‹

Primitive values are straightforward.

const deferredQuery = useDeferredValue(query);

Avoid creating a brand-new object during every render just to defer it:

const deferredFilters = useDeferredValue({ query, sort });

That object is different every render. Prefer stable structured values when identity matters.

const filters = useMemo(() => ({ query, sort }), [query, sort]);
const deferredFilters = useDeferredValue(filters);

React compares values using Object.is semantics when deciding whether background catch-up work is needed.

Effects wait for the deferred render to commitโ€‹

Background render is not committed UI
Deferred background render
No commit yet
Commit
Effects for that committed render run

Inside a Transitionโ€‹

If an update is already inside a Transition, useDeferredValue does not need to create a separate deferred render for that same value. The update is already non-urgent.

Do not mechanically combine every concurrency API; choose the smallest one that expresses the intended priority relationship.

useDeferredValue vs useTransitionโ€‹

Initiated update vs lagging consumer
useTransition
You control the setter and want that update to be non-urgent.
useDeferredValue
The value is already changing; one consumer may lag behind.
startTransition(() => {
setTab(nextTab);
});
const deferredQuery = useDeferredValue(query);

Deferred rendering vs debounceโ€‹

Different timing models
Debounce
User types โ†’ wait โ†’ start work.
Deferred rendering
User types โ†’ urgent UI updates now โ†’ slower subtree catches up when possible.

You can use both when you need both request timing control and rendering responsiveness.

Deferred rendering does not make slow UI cheapโ€‹

If the slow child still re-renders urgently even while its deferred prop is unchanged, component boundaries or memo may still matter.

const SlowList = memo(function SlowList({ text }) {
// expensive rendering
});

const deferredText = useDeferredValue(text);
return <SlowList text={deferredText} />;

Concurrency changes priority; profiling and architecture still decide cost.

Production data-table patternโ€‹

Keep controls urgent; let expensive presentation lag
Urgent state
Input value ยท selected controls ยท accessibility state.
Deferred consumption
Large table ยท summary visualization ยท suspending results.

When not to deferโ€‹

Do not defer values when lag would be confusing or unsafe, for example direct drag position, checkbox state, current accessibility state, or values immediately required for a destructive confirmation.

Can this consumer safely lag?
Old content remains useful and clearly marked staleGood deferred candidate
Interaction itself must reflect current state immediatelyKeep urgent
Problem is too many requestsUse network/data-layer controls
Problem is expensive render costDefer if appropriate, then profile/optimize too

Common mistakesโ€‹

  • treating the deferred value as canonical state;
  • expecting fewer server requests automatically;
  • hiding that visible content is stale;
  • passing unstable objects created during every render;
  • assuming deferral replaces memoization or architecture work.

Debugging checklistโ€‹

  1. Is urgent state updating immediately?
  2. Does the expensive subtree actually receive the deferred value?
  3. Are unstable identities causing extra background work?
  4. Does Suspense preserve old deferred content as expected?
  5. Are requests still firing too often?
  6. Is stale UI visibly communicated?
  7. Is stale UI actually acceptable for this feature?

Exerciseโ€‹

Build a search page with 5,000 local items. Add artificial render cost, compare urgent rendering to useDeferredValue, memoize the list, show stale feedback, and compare the behavior with a 300ms debounce.

Interview questionsโ€‹

Beginner: What does useDeferredValue return?

Intermediate: Why does it not reduce network requests by itself?

Senior: How would you combine urgent input, deferred results, Suspense, memoization, request cancellation, and stale-state UX in production search?

Summaryโ€‹

Deferred-value mental model
Canonical value updates urgently
Background catch-up render
Latest completed presentation commits

Referencesโ€‹

Nextโ€‹

Next, connect these APIs to React's broader concurrent rendering mental model.