examples/solid/basic-graphql-request
| Name | Last commit message | Last commit date |
|---|---|---|
| .. | ||
README.md
TanStack Solid Query Basic GraphQL Request Example#
The basic posts example, fetching from a GraphQL API with graphql-request.
How it works#
src/services/posts/queries.tsdefinespostsQueries.list()andpostsQueries.detail(id)withqueryOptions, keyed by['posts', 'list']and['posts', 'detail', id].src/services/posts/api.tssends GraphQL queries withrequestandgqlfromgraphql-requestto the GraphQLZero API.src/index.tsxpasses these options touseQueryin thePostsandPostcomponents and shows "Background Updating..." whileisFetchingistrue.- The
Postslist callsqueryClient.getQueryData(postsQueries.detail(post.id).queryKey)to style links whose detail is already cached.
To run this example:
npm installnpm run dev