Graphqls
Tiny wrapper around react-apollo's graphql container, with support for multiple queries with a single call.
Install
$ npm install --save react-apollo-graphqls
Usage
The standard react-apollo's graphql container requires a GraphQL query as the first argument, and an optional options object as the second.
This function simply requires a single object, with the GraphQL query being under the gql
property of it. This enables calling it only once but with multiple queries.
;;; const user = gql: gql` query CurrentUserForLayout { currentUser { login avatar_url } } ` options: fetchPolicy: 'network-only' ; const categories = gql: gql` query Categories { categories { _id name description } } ` withRef: true; @Component {} ;
License
MIT © Fabio Spampinato