Course contentsShow
← React
Lesson 1430 of 2,39636. Concurrent ReactFree lesson

The useTransition Hook Signature

Learning the basic API: isPending flag and startTransition function returned from useTransition().

The useTransition Hook Signature

You'll learn the exact API that useTransition returns and what each piece does.

What the Hook Returns

The useTransition hook has a simple but powerful signature. When you call it, you get back exactly two things in an array:

const [isPending, startTransition] = useTransition();

Think of this like a light switch with an indicator lamp: startTransition is the switch you flip to mark updates as non-urgent, and isPending is the little light that shows when those updates are still in progress.

The Two Pieces

isPending (Boolean Flag)

This is a boolean that tells you whether any transition updates are currently running. It starts as false, becomes true when you call startTransition, and goes back to false when React finishes rendering the non-urgent updates.

You typically use this to show loading indicators: "Yes, something is happening in the background, but the UI is still responsive."

startTransition (Function)

This is the function you wrap around state updates that you want to mark as non-urgent. You pass it a callback containing your state setter:

startTransition(() => {
  setSearchResults(newResults); // This update won't block typing
});

React will keep the UI responsive while processing whatever state updates happen inside that callback.

No Arguments Needed

Notice that useTransition() takes no arguments. It's configuration-free. You just call it, destructure the two values, and you're ready to make your UI more responsive.

Key Takeaway: useTransition() returns [isPending, startTransition] — a boolean flag to show loading state and a function to mark updates as non-blocking transitions.