Random Quote Generator — Fetch and Display New Quote

Custom Hooks — Beginner React challenge.

Build a random quote generator across two files: a container that owns fetch/loading state, and a presentational child that renders quote data via props — practicing props drilling, not just async state.

Requirements

Signature

function RandomQuoteGenerator({ fetchQuote: () => Promise<{text, author}> }): JSX.Element
function QuoteDisplay({ quote: {text, author} | null, isLoading: boolean }): JSX.Element

Example

<RandomQuoteGenerator fetchQuote={fetchQuote} />
// mounts -> loading -> first quote card appears automatically
// click "New Quote" -> loading again, button disabled -> new quote replaces old

Constraints

🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code
Loading workspace…