Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Small <Query> wrapper component for react-apollo that supports multiple parallel queries and handles the nesting for you.

Notifications You must be signed in to change notification settings

alfondotnet/react-apollo-queries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-apollo-queries

Small <Query> wrapper component for react-apollo that supports multiple parallel queries and handles the nesting for you.

Instead of:

<Query query={LOAD_USER} variables={{ userId: this.props.userId }}>
  {({ data }) => <Query query={LOAD_IMAGES}}>
    ...
  </Query>}
</Query>

Write:

<Queries queries={[LOAD_USER, LOAD_IMAGES]} queriesProps={[
  {
    variables: { userId: this.props.userId}
  }
]}>
  {([ {data: userData }, {data: imagesData }]) => ...}
</Queries>

Motivation

When migrating to graphQL, and using something like apollo-link-rest, sometimes you want to throw parallel queries so faster fields don't have to wait on slower ones.

About

Small <Query> wrapper component for react-apollo that supports multiple parallel queries and handles the nesting for you.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published