startTransition – React
startTransition – React
v19
startTransition
startTransition lets you render a part of the UI in the
background.
startTransition(action)
Reference
startTransition(action)
Usage
Reference
startTransition(action)
function TabContainer() {
const [tab, setTab] = useState('about');
function selectTab(nextTab) {
startTransition(() => {
setTab(nextTab);
});
}
// ...
https://react.dev/reference/react/startTransition 1/5
20/02/2025, 09:20 startTransition – React
Parameters
action : A function that updates some state by calling one or more set
functions. React calls action immediately with no parameters and marks
all state updates scheduled synchronously during the action function
call as Transitions. Any async calls awaited in the action will be included
in the transition, but currently require wrapping any set functions after
the await in an additional startTransition (see Troubleshooting). State
updates marked as Transitions will be non-blocking and will not display
unwanted loading indicators..
Returns
Caveats
You can wrap an update into a Transition only if you have access to the
set function of that state. If you want to start a Transition in response to
some prop or a custom Hook return value, try useDeferredValue instead.
You must wrap any state updates after any async requests in another
startTransition to mark them as Transitions. This is a known limitation
that we will fix in the future (see Troubleshooting).
https://react.dev/reference/react/startTransition 2/5
20/02/2025, 09:20 startTransition – React
Transition, but then start typing into an input while the chart is in the
middle of a re-render, React will restart the rendering work on the chart
component after handling the input state update.
Usage
function TabContainer() {
const [tab, setTab] = useState('about');
function selectTab(nextTab) {
startTransition(() => {
setTab(nextTab);
});
}
// ...
}
Transitions let you keep the user interface updates responsive even on slow
devices.
https://react.dev/reference/react/startTransition 3/5
20/02/2025, 09:20 startTransition – React
Note
PREVIOUS
memo
NEXT
use
uwu?
Describing the UI
Adding Interactivity
https://react.dev/reference/react/startTransition 4/5
20/02/2025, 09:20 startTransition – React
Managing State
Escape Hatches
Community More
Acknowledgements Terms
https://react.dev/reference/react/startTransition 5/5