← GraphQL learning pathGraphQL · Module 7 of 10
GraphQL on the client
Use Apollo Client or urql to query from React and other front-ends.
📖 Key ideas
- Apollo Client and urql are popular clients.
- useQuery(GET_USERS) returns { data, loading, error }.
- useMutation for writes, then update the cache.
- Normalised caching stores objects by id.
- Codegen creates TypeScript types from the schema.
💡 Real-life example: Apollo Client is a personal assistant that remembers every answer, so you don't ask the server twice.
Apollo ClientGraphQL client with caching
useQueryReact hook to run a query
Normalised cacheObjects stored by type and id
GraphQL CodegenGenerates types from schema