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

Suspense Boundaries: Where to Place Them

Strategic placement of Suspense boundaries controls loading granularity—wrap routes, sections, or individual components.

Suspense Boundaries: Where to Place Them

You'll learn how strategic placement of Suspense boundaries controls loading granularity and user experience.

The Placement Decision

Just like Error Boundaries, Suspense boundaries create "zones" in your component tree. Where you place them determines what shows a loading state together. This isn't a technical requirement—it's a design choice that dramatically affects user experience.

Think of Suspense boundaries like curtains in a theater: you decide whether the entire stage goes dark, just one section, or individual props. Each choice creates a different audience experience.

Placement Strategies

Route-Level Boundaries
Wrap entire routes to show a single loading state for the whole page. Simple and predictable—users see one spinner, then complete content:

<Route path="/profile" element={
  <Suspense fallback={<PageSpinner />}>
    <ProfilePage />
  </Suspense>
} />

Section-Level Boundaries
Wrap independent sections so the page loads progressively. The header appears immediately while content loads:

<Suspense fallback={<HeaderSkeleton />}>
  <Header />
</Suspense>
<Suspense fallback={<ContentSkeleton />}>
  <MainContent />
</Suspense>

Component-Level Boundaries
Wrap individual slow components. The rest of the UI remains interactive:

<ProfileInfo />
<Suspense fallback={<Spinner />}>
  <SlowWidget />
</Suspense>

Choosing Granularity

Coarse boundaries (route-level) mean fewer loading states but longer waits. Fine boundaries (component-level) show more of the UI faster but create visual noise with multiple spinners.

The right choice depends on:

  • Data dependencies (does B need A's result?)
  • User expectations (profile pages traditionally load as one unit)
  • Visual cohesion (too many loading states = chaos)

Key Takeaway: Place Suspense boundaries where you want loading to pause—wrap routes for simplicity, sections for progressive loading, or components for surgical control. The boundary defines what waits together.