apollo-link-fragment-argument
An Apollo Link to enable@argumentDefinitions
and @arguments
directives inspired from Relay Modern's Fragment container.
Usage
Install
$ npm i apollo-link-fragment-argument
Configure apollo client
;;;; ;
@argumentDefinitions
and @arguments
directive in your query
Using ;
;
Why?
I'm loving GraphQL's fragments colocation.
combined with GraphQL's support for fragments, allows you to split your queries up in such a way that the various fields fetched by the queries are located right alongside the code that uses the field.
However, GraphQL syntax has no ability to parameterize Fragment (See https://github.com/graphql/graphql-spec/issues/204 if you want detail).
@argumentDefinitions
and @arguments
are originally introduced by Relay Modern to compose parametrized Fragments. See https://relay.dev/docs/en/fragment-container.html#composing-fragments ,
License
MIT