Overview
React’s concurrent features allow you to keep your app responsive during expensive updates. These features include transitions, deferred values, and concurrent rendering, which help prioritize urgent updates over less important ones.
Transitions
Transitions allow you to mark updates as non-urgent, keeping the UI responsive during expensive operations.
useTransition Hook
From packages/react/src/ReactHooks.js:170:
Basic Usage
startTransition API
From packages/react/src/ReactStartTransition.js:45:
Standalone startTransition
Use startTransition outside of components:
Transition Internal Implementation
From packages/react/src/ReactStartTransition.js:30:
Transitions track:
- types: View transition types (experimental)
- gesture: Gesture providers (experimental)
- name: Debug name for transition tracing
- startTime: When the transition started
- _updatedFibers: Fibers updated during transition (dev only)
Deferred Values
Deferred values let you defer updating a part of the UI until more urgent updates have finished.
useDeferredValue Hook
From packages/react/src/ReactHooks.js:178:
Basic Usage
With Loading Indicator
Transition vs Deferred Value
Use useTransition when:
- You control the state update
- You want to show pending state
- You need to start transitions imperatively
Use useDeferredValue when:
- You receive a value from props or another hook
- You want to defer rendering of received values
- You want to show stale content during updates
Practical Examples
Tab Switching
Search with Debounced Results
Router Navigation
Optimistic Updates
Transition Warning
From packages/react/src/ReactStartTransition.js:193, React warns about excessive updates in transitions:Avoid subscribing to external stores inside transitions. Use React’s hooks instead.
Async Transitions
From packages/react/src/ReactStartTransition.js:82, transitions can be async:
Gesture Transitions (Experimental)
From packages/react/src/ReactStartTransition.js:119:
This API is experimental and not yet stable. Async functions are not supported in gesture transitions.
Best Practices
-
Prioritize user input: Keep input updates outside transitions
-
Show loading states: Use
isPending to provide feedback
-
Memoize expensive computations: Combine with
useMemo and memo
-
Avoid transition abuse: Don’t wrap everything in transitions
-
Test on slow devices: Transitions are most valuable on slower hardware
-
Use appropriate indicators: Show subtle indicators for deferred updates
-
Handle errors: Transitions can fail, handle errors appropriately
-
Interruption: Transitions can be interrupted by urgent updates
-
Batching: React batches multiple transition updates
-
Priority: Urgent updates always take priority over transitions
-
Memory: Transitions keep old UI in memory briefly
Debugging Transitions
See Also