Open History to see the last commit
1# TanStack React Query Simple Example
2β
3Fetches a single GitHub repository and shows its stats.
4β
5## How it works
6β
7- `src/index.tsx` creates a `QueryClient` and provides it with `QueryClientProvider`.
8- `Example` in `src/index.tsx` calls `useQuery` with `queryKey: ['repoData']` and an inline `queryFn` that fetches the `TanStack/query` repository from the GitHub API.
9- The component in `src/index.tsx` shows "Loading..." while `isPending` is `true`, the error message when `error` is set, and "Updating..." while `isFetching` is `true` during a background refetch.
10β
11To run this example:
12β
13- `npm install`
14- `npm run dev`