Hook that fetches a random Games Of Thrones quote.
✓ Published0🌍 Public
Aabonello
Last edited Aug 13, 2021
Created on Dec 30, 2021
This example demonstrates a React hook that fetches a random quote from the Game of Thrones universe and displays it as plain text. It uses the `useState` and `useEffect` hooks from React to manage the quote data and trigger a single API call when the component mounts. The fetch request targets the `game-of-thrones-quotes.herokuapp.com` REST API, and the response’s `sentence` field is stored in local state. No rendering library beyond React is used; the hook returns the quote string for the component to render directly.
AI-generated description