Skip to content

.tip

· one of the small things

Wrap the slow widget in Suspense, not the page

A page with one slow query waits for that query before it sends anything. A Suspense boundary around the slow component lets the rest stream first, and the slow part arrives when it's ready.

<Suspense fallback={<ActivitySkeleton />}>
  <ActivityFeed accountId={id} />
</Suspense>

Put the boundary as close to the slow thing as you can. A boundary around the whole page is no better than having none.

reactnextjs