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

Nested Transitions and Multiple startTransition Calls

Understanding how multiple concurrent transitions interact and when to use separate useTransition hooks.

Nested Transitions and Multiple startTransition Calls

What you'll learn: How React handles overlapping transitions when you call startTransition multiple times or nest them within each other.

The Core Idea

When you have multiple startTransition calls—whether from different hooks or nested inside each other—React manages them intelligently. Each startTransition marks updates as low-priority, but they don't queue up waiting for each other. Instead, new transitions interrupt and replace older, pending transitions.

Think of it like typing in a search box rapidly: if you type "c-a-t" quickly, you don't want React to render results for "c", then "ca", then "cat". You only care about "cat". React automatically cancels the earlier transitions when a new one starts.

Multiple useTransition Hooks

You can use multiple useTransition hooks in the same component or across different components:

function Dashboard() {
  const [isPendingSearch, startSearchTransition] = useTransition();
  const [isPendingFilter, startFilterTransition] = useTransition();
  
  // Each startTransition works independently
  // New calls interrupt their own pending transitions
}

Each isPending flag tracks only its own transition, but the actual state updates follow React's interruption rules.

When to Use Separate Hooks

Use separate useTransition hooks when you have distinct loading indicators for different UI concerns. For example, a search box and a filter dropdown might show separate loading states, helping users understand what's updating.

Use a single useTransition when multiple updates relate to one user action and should share a loading state.

Key Takeaway: Multiple startTransition calls don't queue—newer transitions interrupt older ones. Use separate useTransition hooks only when you need independent isPending flags for different UI feedback.