Using Apollo's local cache for global state management with Typescript, codegen and remote resolvers
If your project is using the apollo-client to communicate with your GraphQL backend, there is no need to include redux or mobx for the global state management; you can store this state in the same Apollo client you are already using. This will be a contrived example, but this post will cover:
- Setting up local queries and mutations to take advantage of the cache
- Integrating the
apollo-clientyou are already using with the local graphql - Setting up a GraphQL schema locally to use for
typeDefsandcodegen - Using
@graphql-codegento create custom hooks for your queries and mutations