DEV Community


Which GraphQL client do you use, and why?

In one of my side projects, I'm currently using Apollo Client, but I'm starting to find writing the code to update the cache after a query or mutation rather cumbersome. I'm thinking about switching to Relay, which, if I understand things correctly, handles a lot of that for you, in exchange to some restrictions it imposes on your schema.

So I'd like to hear from more people which client you're using and why. I'm also interested in any tools you're using, like code generators or utility libraries, to reduce boilerplate code.

Top comments (5)

sibelius profile image
Sibelius Seraphini

Relay can handle most updates after mutations, you can easily use updater to handle adding and removing edges from a connection

All queries are static so you gonna have much less weird behaviors when updating relay store/cache

ianfabs profile image
Ian Fabs • Edited

You should change the title from "... GraphQL query..." to "...GraphQL query client..." also you should use jraph. It is not feature-complete, and only makes queries.

_bigblind profile image
Frederik πŸ‘¨β€πŸ’»βž‘οΈπŸŒ Creemers

Derp, I messed up on the title, thanks for noticing. Will check out jraph.

ianfabs profile image
Ian Fabs

no problem! Let me know what you think of jraph :-)

guico33 profile image

Why do you need to manually update the cache?

11 Tips That Make You a Better Typescript Programmer


1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields


Read the whole post now!