Last active
September 12, 2018 14:44
-
-
Save unicodeveloper/e351595bcca6f7cebc671f0a7f406aaf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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