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
Frompackages/react/src/ReactHooks.js:170:
Basic Usage
startTransition API
Frompackages/react/src/ReactStartTransition.js:45:
Standalone startTransition
UsestartTransition outside of components:
Transition Internal Implementation
Frompackages/react/src/ReactStartTransition.js:30:
- 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
Frompackages/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
- 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
Async Transitions
Frompackages/react/src/ReactStartTransition.js:82, transitions can be async:
Gesture Transitions (Experimental)
Frompackages/react/src/ReactStartTransition.js:119:
Best Practices
- Prioritize user input: Keep input updates outside transitions
-
Show loading states: Use
isPendingto provide feedback -
Memoize expensive computations: Combine with
useMemoandmemo - 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
Performance Considerations
- 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
- Suspense - Loading states for async operations
- Hooks - All available React hooks
- Performance - Optimization techniques