examples/react/simple
| Name | Last commit message | Last commit date |
|---|---|---|
| .. | ||
README.md
TanStack React Query Simple Example#
Fetches a single GitHub repository and shows its stats.
How it works#
src/index.tsxcreates aQueryClientand provides it withQueryClientProvider.Exampleinsrc/index.tsxcallsuseQuerywithqueryKey: ['repoData']and an inlinequeryFnthat fetches theTanStack/queryrepository from the GitHub API.- The component in
src/index.tsxshows "Loading..." whileisPendingistrue, the error message whenerroris set, and "Updating..." whileisFetchingistrueduring a background refetch.
To run this example:
npm installnpm run dev