Skip to content

Instantly share code, notes, and snippets.

@unicodeveloper
Last active September 12, 2018 14:44
Show Gist options
  • Save unicodeveloper/e351595bcca6f7cebc671f0a7f406aaf to your computer and use it in GitHub Desktop.
Save unicodeveloper/e351595bcca6f7cebc671f0a7f406aaf to your computer and use it in GitHub Desktop.
const FirstQuery = gql`
query One {
one
}
`;
const SecondQuery = gql`
query Two {
two
}
`;
const withOne = graphql(FirstQuery, {
props: ({ data }) => ({
loadingOne: data.loading,
one: data.one
}),
});
const withTwo = graphql(SecondQuery, {
props: ({ data }) => ({
loadingTwo: data.loading,
two: data.two
}),
});
const Numbers = ({ loadingOne, loadingTwo, one, two }) => {
if (loadingOne || loadingTwo) return <span>loading...</span>
return <h3>{one} is less than {two}</h3>
};
const NumbersWithData = compose(withOne, withTwo)(Numbers);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment