Fallback Transitions: Old UI vs New UI
What you'll learn: How to control whether React shows old content or a loading fallback during navigation with Suspense boundaries.
The Navigation Dilemma
When navigating between pages or views that suspend (like lazy-loaded routes or data-fetching components), you face a choice: should users see the current screen while waiting, or immediately replace it with a spinner?
By default, React replaces suspended content with the nearest Suspense boundary's fallback. This means clicking a link instantly shows your spinner, even if the new content arrives quickly. This can feel jarring—users lose context and see flashing loaders.
The Old UI Alternative
Sometimes it's better to keep the old UI visible while the new one loads in the background. Users stay oriented, and if loading is fast, they never see a spinner at all. This creates smoother transitions, especially for small navigation changes.
However, you don't control this with Suspense props. Instead, you use useTransition (which we've learned about earlier in concurrent rendering). When you wrap navigation logic in startTransition, React keeps the old UI on screen and marks it as "stale" while preparing the new one.
When to Use Each Approach
Show fallback immediately when:
- Users expect a distinct "page change" moment
- The old content is unrelated to what's loading
- Loading might take several seconds
Keep old UI visible when:
- Navigation feels like an "update" rather than a jump
- The old content provides helpful context
- You want to avoid spinner flashes on fast loads
Key Takeaway: Suspense boundaries show fallbacks by default, but wrapping navigation in useTransition keeps old content visible during loading, creating smoother user experiences when appropriate.