DEV Community

Discussion on: A Better Way to use GraphQL Fragments in React

Collapse
 
aleccool213 profile image
Alec Brunelle

Wow 😯 Thanks for the informative comment! That’s so neat that FB/Relay started off with implementing this pattern. I’ve been using it for a while now and wish it was integrated into Apollo more.

One thing, regardless of library, I wish the GraphQL spec supported are paramaterized fragments. That would make this pattern even more viable!

Collapse
 
andrewingram profile image
andrewingram

Yeah. Relay’s rewrite in 2017 added support for parameterised fragments, which makes marrying GraphQL with the component paradigm a lot more successful, but it does some client-side processing to support it. If it were supported everywhere it would be great.

I wouldn’t advocate a big rewrite in Relay because the learning curve is steep. But it’s worth checking out for its ideas.