Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Expose `compose` method

Compare
Choose a tag to compare
@jbaxleyiii jbaxleyiii released this 06 Sep 01:01
· 2625 commits to master since this release

from #194

This makes including multiple graphql HOCs on a single component much easier. It uses the compose method from recompose.

// component
const Template = (props) => (<div></div>);

// old
import { graphql } from 'react-apollo';

const withPeople = graphql(peopleQuery, { name: 'people' });
const withShips = graphql(shipsQuery, { name: 'ships' });

const ContainerWithData = withPeople(withShips(Template));

// new
import { compose, graphql } from 'react-apollo';

const ContainerWithData = compose(
  graphql(peopleQuery, { name: 'people' }),
  graphql(shipsQuery, { name: 'ships' })
)(Template);