← GraphQL learning path
GraphQL · Module 7 of 10

GraphQL on the client

Use Apollo Client or urql to query from React and other front-ends.

📖 Key ideas

  1. Apollo Client and urql are popular clients.
  2. useQuery(GET_USERS) returns { data, loading, error }.
  3. useMutation for writes, then update the cache.
  4. Normalised caching stores objects by id.
  5. 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