Skip to content

QuizNot attempted

What useTransition returns

What does useTransition() return, and what is the correct destructuring order shown above?
function App() {
const [isPending, startTransition] = useTransition();
const [tab, setTab] = useState('home');
function selectTab(next) {
startTransition(() => {
setTab(next);
});
}
return (
<div>
{isPending ? 'Loading...' : tab}
<button onClick={() => selectTab('profile')}>Profile</button>
</div>
);
}
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • [isPending, startTransition] — a boolean pending flag and a function to mark updates as non-urgent
  • useTransition() returns an array [isPending, startTransition]: a boolean that is true while a transition is rendering, and a function that marks the updates inside it as non-urgent.
  • Not reversed: the flag comes first.
  • Not an object: like useState, it returns a tuple.
  • Not isPending only: startTransition is in the tuple (a standalone startTransition export also exists, but it has no pending flag).