Open History to see the last commit
1# TanStack Solid Query Basic GraphQL Request Example
2β
3The basic posts example, fetching from a GraphQL API with `graphql-request`.
4β
5## How it works
6β
7- `src/services/posts/queries.ts` defines `postsQueries.list()` and `postsQueries.detail(id)` with `queryOptions`, keyed by `['posts', 'list']` and `['posts', 'detail', id]`.
8- `src/services/posts/api.ts` sends GraphQL queries with `request` and `gql` from `graphql-request` to the GraphQLZero API.
9- `src/index.tsx` passes these options to `useQuery` in the `Posts` and `Post` components and shows "Background Updating..." while `isFetching` is `true`.
10- The `Posts` list calls `queryClient.getQueryData(postsQueries.detail(post.id).queryKey)` to style links whose detail is already cached.
11β
12To run this example:
13β
14- `npm install`
15- `npm run dev`