Deferred vs Non-Deferred Values
You'll learn how React maintains two separate versions of a value when using useDeferredValue: the urgent current value and the deferred lower-priority value.
Two Values Living Side-by-Side
When you pass a value to useDeferredValue, React doesn't replace your original value—it creates a second, deferred version of it. This means your component simultaneously has access to:
- The non-deferred value: The real-time, up-to-date value that changes immediately with every update
- The deferred value: A "lagging behind" version that updates only when React has spare time after urgent work
Think of it like a news ticker and a printed newspaper. The ticker (non-deferred) updates instantly with breaking news, while the newspaper (deferred) publishes the same stories but on a delayed schedule, waiting for a convenient printing time.
Why Two Values Matter
The non-deferred value lets you keep critical UI responsive. For example, an input field should always reflect what the user typed instantly. The deferred value lets expensive components update without blocking, using the slightly-stale version until React can afford to compute the fresh one.
const [searchQuery, setSearchQuery] = useState('');
const deferredQuery = useDeferredValue(searchQuery);
// searchQuery: always current, user sees instant feedback
// deferredQuery: lags behind, used for expensive list filtering
The input uses searchQuery directly (non-deferred) so typing feels instant. The heavy search results component uses deferredQuery, allowing it to render "later" without freezing the input.
How React Manages Both
React tracks both values internally. When you update the original, React marks the deferred version's update as low priority. If more urgent work arrives (like another keystroke), React pauses the deferred update and starts over with the newest value.
Key Takeaway: useDeferredValue doesn't slow down or debounce—it creates a parallel, lower-priority version of your value that React updates whenever it can, while the original stays instantly responsive.