Last active
July 24, 2021 12:56
-
-
Save unicodeveloper/830db81edafe34cda77af5ae17116613 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 User = ({ id, children }) => { | |
<Query query={GET_USER} variables={{ userId }}> | |
{({ loading, data }) => (children({ user: data})) | |
</Query> | |
} | |
const UserStartup = ({ user: { email }, children }) => ( | |
<Query query={GET_HACKERNEWS_STARTUP} variables={{ email }}> | |
{({ loading, data: { startup } }) => ( | |
<Query query={GET_REPO} variables = {{ startup }}> | |
{({loading, error, data: { correspondingRepo: repo } }) => ( | |
children({ repo, email, startup }) | |
)} | |
</Query> | |
)} | |
</Query> | |
) | |
const UI = ({ repo, email, startup, loading, error }) => { | |
if (loading) return <p>Loading...</p>; | |
if (error) return <p>Error...</p>; | |
return ( | |
<div> | |
<p> corresponding Repo for { email } and { startup } : { repo } </p> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment