Let’s manage our local state with GraphQL
summary
Argues that GraphQL/Apollo can replace Redux for local UI state when an app already uses GraphQL, showing code that uses react-apollo-hooks, useQuery/useMutation and useApolloClient with Apollo Boost to call client.writeData or small resolvers instead of dispatching actions. Demonstrates a working modal: defaults set visible=false, mutation or direct cache write toggles visible and the modal opens/closes. Warns this simplifies code but cautions against using it in non-GraphQL projects or for overly complex cache writes.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 4:03GraphQL for local state
- 7:12Apollo Client setup
- 9:20Defaults and resolvers in Apollo
- 12:31GraphQL queries and mutations
- 14:16Apollo hooks for state
- 16:47Custom components for hooks
- 18:36Direct cache access with useApolloClient
- 21:06Combining queries and mutations
- 23:13Live demo: modal state
- 25:01When to use GraphQL locally
- 25:43Resources and closing
related talks
26mLet's manage our local state with GraphQL
24mState Management in React Apps with Apollo Client
25mReact state management in a GraphQL era
20mGQL all the Things!
24mReact State Management In a GraphQL Era
52mState management in a GraphQL era
27mReact State Management In a GraphQL Era
05mState management in a GraphQL era
