Command Palette

Search for a command to run...

Hectal
Phase 20: Server Components and Next.js
React · Exercise 4 of 5 PreviousNext
Advanced

Stream each slow part on its own

This page is server-rendered with renderToReadableStream and streamed into #root (the code at the bottom plays the browser). Two slow "queries" finish when you click the buttons Finish details and Finish reviews.

Right now one <Suspense> boundary wraps both parts, so the price can't appear until the reviews are ready too. Give each part its own boundary, with the fallbacks Loading details... and Loading reviews..., so the price streams in as soon as the details finish.

What Check tests

  1. The shell shows the heading and both fallbacks
  2. After Finish details, the price appears while reviews still load
  3. After Finish reviews, the reviews appear
  4. Uses two <Suspense> boundaries

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.