// src/App.jsx import { useQuery } from "@tanstack/react-query"; function JokeList() { const { data, isLoading, isError } = useQuery({ queryKey: ["jokes"], queryFn: () => fetch("https://official-joke-api.appspot.com/jokes/ten").then((r) => r.json()), }); if (isLoading) return

Loading...

; if (isError) return

Something went wrong.

; return ( ); } function App() { return ; } export default App; /* Notes: - useQuery handles the entire loading/error/success cycle — no useState or useEffect written by hand anywhere in this component. - queryFn is just a function returning a Promise; useQuery calls it and manages everything else around that call. */