useDeferredValue is a React Hook that lets you defer updating a part of the UI.
Parameters
T
required
The value you want to defer. It can be of any type.
T
Optional value to use during the initial render. If omitted,
useDeferredValue will return value on initial render, then schedule a re-render with the deferred value.This parameter is useful to avoid showing a blank screen on the first render.Returns
- During the initial render, the returned deferred value will be the same as the value you provided (or
initialValueif provided) - During updates, React will first attempt a re-render with the old value (matching the old
value), then try another re-render in background with the new value (matching the updatedvalue)
Usage
Showing stale content while fresh content is loading
CalluseDeferredValue at the top level of your component to get a deferred version of that value:
query), but the results update with a slight delay (using deferredQuery). This keeps the input responsive.
Indicating that the content is stale
Show a visual indication while the deferred value is updating:Deferring re-rendering for a part of the UI
You can also useuseDeferredValue as a performance optimization:
This optimization requires the children to be wrapped in
memo. Without memo, React will re-render the entire subtree anyway.Common Patterns
Search with deferred results
- Basic Search
- With Loading State
- With Dimming
Filter with deferred updates
Table with deferred sorting
TypeScript
useDeferredValue vs useTransition
- useDeferredValue
- useTransition
- You receive a value from props or a parent component
- You don’t control the state update
- You want to defer rendering based on a value
Troubleshooting
The deferred value never updates
Make sure the component using the deferred value can re-render:My UI still feels slow
Make sure the expensive work is actually being deferred:The deferred update happens immediately
If React has nothing else to do, it will update the deferred value immediately:Should I defer all values?
No! Only defer values when:- Rendering is expensive and takes >50ms
- You want to keep the UI responsive during updates
- The delayed update won’t confuse users
- Rendering is fast (less than 50ms)
- Users expect immediate feedback
- The value controls critical UI