Course contentsShow
← React
Lesson 1376 of 2,39634. Suspense FundamentalsFree lesson

What Suspense Boundaries Contain

Understanding how Suspense wraps multiple components and shows fallback when any child suspends.

What Suspense Boundaries Contain

What you'll learn: How a single Suspense boundary wraps multiple components and shows its fallback whenever any child suspends.

The Container Concept

A <Suspense> boundary acts as a container around a portion of your component tree. Everything nested inside it — whether one component or dozens — falls under its jurisdiction. When any component within that boundary suspends (throws a promise), the entire boundary switches to its fallback UI.

Think of it like a fire alarm system for a floor of an office building. One smoke detector triggering anywhere on that floor causes the entire floor's alarm to activate and evacuation procedures to start. Similarly, one suspended component triggers the fallback for everything inside that Suspense boundary.

How It Works in Practice

<Suspense fallback={<Spinner />}>
  <UserProfile />
  <RecentPosts />
  <Comments />
</Suspense>

If UserProfile is ready but RecentPosts suspends while loading data, the entire boundary shows <Spinner />. You won't see UserProfile — even though it's ready — because the boundary treats all its children as a single unit.

This "all-or-nothing" behavior is intentional: it prevents jarring partial UI where some parts load before others in a disjointed way.

Controlling Granularity

You control what gets hidden together by choosing where to place boundaries. Want UserProfile to remain visible while posts load separately? Use nested boundaries:

<Suspense fallback={<ProfileSkeleton />}>
  <UserProfile />
</Suspense>
<Suspense fallback={<PostsSkeleton />}>
  <RecentPosts />
  <Comments />
</Suspense>

Now each boundary operates independently.

Key Takeaway: A Suspense boundary wraps all its children as one loading unit — if any child suspends, the entire boundary shows its fallback, not just the suspended component.