3 ms·
As someone who works daily with GraphQL, it's neat to see other people talking about this. The tools for client-side state management with GraphQL are really p
by gavinray 6y ago
As someone who works daily with GraphQL, it's neat to see other people talking about this.
The tools for client-side state management with GraphQL are really powerful, but require a lot more involvement than something like a standard state management store, IE an action that calls your GQL endpoint and stores the data in state.
async function fetchUsersAction(state) {
const users = await gql.getAllUsersQuery()
state.users = users
return state
}
I generally set up a regular client-side GQL library (urql, Apollo) and use this kind of pattern for store state.
This approach has worked well for me in a number of fairly decent-sized apps, and it seems to be a pretty common one.