You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vinibiavatti1 edited this page Sep 28, 2026
·
2 revisions
Allows to mark a state update as a non-blocking transition. React will prioritize urgent updates (like typing or clicking) and let background renders yield to user input.
import{useState,useTransition}from'react';exportconstMyComponent=()=>{const[tab,setTab]=useState('tab 1');const[isPending,startTransition]=useTransition();constnextTab=()=>{// Marks state update as low-prioritystartTransition(()=>{setTab('tab 2');});};return(<><buttononClick={nextTab}>Next Tab</button>{isPending&&<span>Loading...</span>}</>);};