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

Transitions and Component Re-renders

Understanding how transition updates can be interrupted and restarted as new urgent updates arrive.

Transitions and Component Re-renders

What you'll learn: How transition updates can be interrupted and restarted when new urgent updates arrive, giving you control over React's re-render prioritization.

The Interruptible Nature of Transitions

When you wrap a state update in startTransition, you're telling React: "This update can be interrupted if something more urgent comes along." This is fundamentally different from normal state updates, which React commits immediately once started.

Here's the key behavior: if a user types another character while React is still rendering the expensive transition update (like filtering a large list), React will abandon the in-progress render and restart with the new, more urgent update. The transition update gets interrupted, not queued.

How Re-renders Work with Transitions

Think of it like a chef preparing a complex dish (transition update) who gets interrupted by a quick order for a glass of water (urgent update). The chef stops mid-preparation, handles the water, then starts the complex dish fresh with any new information—they don't try to resume from where they left off.

In practice:

  • User types "a" → transition starts rendering filtered results for "a"
  • User types "b" before that render finishes → React abandons "a" render
  • React immediately handles the urgent input update (showing "ab" in the input)
  • React then starts a fresh transition render for "ab"

This means components may re-render multiple times for a single interaction—once for the urgent update, and potentially several times as transitions get interrupted and restarted.

Key Takeaway: Transition updates are interruptible and restartable—React abandons in-progress transition renders when urgent updates arrive, preventing wasted work on stale states and keeping the UI responsive to user input.