Course contentsShow
← React
Lesson 1450 of 2,39636. Concurrent ReactFree lesson

Deferred Values and Suspense

How useDeferredValue interacts with Suspense boundaries to show stale content during async loads.

Deferred Values and Suspense

You'll learn: How useDeferredValue coordinates with Suspense boundaries to keep stale content visible while async operations load.

When you defer a value that triggers a Suspense boundary (like a prop passed to a component fetching data), React has a choice: show the fallback spinner immediately, or keep the old UI visible while the new data loads in the background.

React chooses to keep showing stale content during the deferral period instead of replacing it with the fallback.

How It Works

Imagine a search box filtering server-fetched results wrapped in a Suspense boundary. Without useDeferredValue, typing triggers the Suspense fallback immediately—your results disappear and you see a spinner.

With useDeferredValue, React shows the previous results (now stale) while the new query loads. The deferred value lags behind, yes, but it prevents the jarring "everything disappeared" experience.

The Visual Flow

  1. User types new input
  2. Urgent state updates immediately (input field shows new text)
  3. Deferred value stays at old value temporarily
  4. Component using deferred value keeps showing old content (no fallback)
  5. When new data resolves, deferred value updates and new content appears

This creates a "keep the old thing visible" pattern instead of "show loading spinner" pattern.

Why This Matters

Suspense boundaries normally prioritize showing you something loaded over something loading. Deferred values flip this: they prioritize showing you something (even if stale) over a loading state.

Key Takeaway: useDeferredValue tells Suspense boundaries to display stale content instead of fallback UI during transitions, creating smoother perceived performance for users.