Starting a transition without the hook
useTransition gives you an isPending flag, but sometimes you do not need to
show a pending state. Sometimes you cannot call a hook at all, because the
update happens outside a component — in a router, a store, or a plain helper.
React still lets you say the update can wait.
It exports the startTransition function on its own:
import { startTransition } from 'react';
startTransition(() => {
setTab('About');
});
It is the same function the hook returns, minus the pending flag. Every state update inside the callback is marked non-urgent. React keeps the current screen interactive, processes the update in the background, and commits it when it is ready. Urgent updates, like typing in an input, can jump ahead and restart the transition with the newer value.
Use the hook when a component needs to know whether a transition is in flight.
Use the standalone startTransition when you only want to say the update can
wait. Because it is a plain import, you can call it from anywhere, not only
inside a component.
Your job is to switch a panel inside a transition.
Challenge
Clicking a tab should not block the screen while the next one loads. Export an
App component from App.jsx that renders a Home, an About, and a
Contact button, plus a <p> showing the active tab. Clicking a button starts a
transition with the standalone startTransition that sets the active tab to that
button's name.
The Test clicks About and expects the paragraph to read About. The starter
renders the same three buttons but a fixed Home paragraph, so the Test fails.