New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added link to recompose's compose method #194

Merged
merged 2 commits into from Sep 6, 2016

Conversation

Projects
None yet
4 participants
@jbaxleyiii
Copy link
Member

jbaxleyiii commented Sep 6, 2016

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);

@zol zol added the in progress label Sep 6, 2016

James Baxley

@jbaxleyiii jbaxleyiii merged commit 4a9ffec into master Sep 6, 2016

5 checks passed

./dist/index.min.js +417 bytes (+1.57%) → 26,574 bytes
CLA Author has signed the Meteor CLA.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 97.753%
Details

@jbaxleyiii jbaxleyiii deleted the compose branch Sep 6, 2016

@zol zol removed the in progress label Sep 6, 2016

@@ -101,6 +101,7 @@
"lodash.flatten": "^4.2.0",
"lodash.isequal": "^4.1.1",
"lodash.isobject": "^3.0.2",
"object-assign": "^4.0.1"
"object-assign": "^4.0.1",
"recompose": "^0.20.2"

This comment has been minimized.

@stubailo

stubailo Sep 6, 2016

Member

Is this a big dependency? Doesn't redux also have a compose function we could use? Or are they different?

@sedubois

This comment has been minimized.

Copy link

sedubois commented Nov 9, 2016

Could this compose method be documented somewhere? It doesn't seem to be visible in http://dev.apollodata.com/react/.

@sedubois sedubois referenced this pull request Nov 9, 2016

Open

Composing mutations #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment