Home / Learn React / useTransition and useDeferredValue
useTransition and useDeferredValue
Some updates are urgent (typing in a box) and some can wait (filtering ten thousand rows). These hooks let you mark slow updates as non urgent so the page stays smooth.
Theory in plain words
What it is
useTransition gives you [isPending, startTransition]. Updates wrapped in startTransition are "transitions": React can interrupt them if something more urgent happens. useDeferredValue(value) returns an older value first and the new one when React is free.
Why we use it
A slow render blocks the browser. If every keystroke triggers a heavy list render, typing feels laggy. Transitions let the input update at once while the heavy part catches up.
How it works
React renders the urgent update first (the input text), then renders the transition in the background. If you type again, it throws the old background work away and starts over with the latest value.
Where it is used
- Search boxes that filter big lists
- Tab switching with slow content
- Charts and tables that recompute from an input
- Navigations in router frameworks
useDeferredValue
The input stays smooth because the list uses the deferred value.
useTransition
Quick quiz
1. What does startTransition do?
Urgent updates like typing stay responsive.
2. What does useDeferredValue return?
It updates after urgent work.
3. What should you defer?
The input itself must update immediately.
Common questions
What does startTransition do?
Marks an update as non urgent so React can interrupt it. Urgent updates like typing stay responsive.
What does useDeferredValue return?
A copy of the value that may lag behind. It updates after urgent work.
What should you defer?
The result that depends on the input. The input itself must update immediately.