Command Palette

Search for a command to run...

Hectal
Phase 14: Data Fetching and Async UI
React · Exercise 3 of 6 PreviousNext
Advanced

Read a promise with use() and Suspense

fetchQuote() logs fetching quote and resolves to a quote string after 500 ms.

Start the request once, outside any component, and read it in Quote with React 19's use().

Wrap <Quote /> in <Suspense> with the fallback <p id="fallback">Loading quote...</p>. Quote renders the text in <blockquote id="quote">.

What Check tests

  1. The code uses use(...) and a <Suspense> boundary
  2. While the quote loads, only the #fallback is shown
  3. The quote replaces the fallback
  4. The quote is fetched exactly once

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.