Last active
March 3, 2018 10:50
-
-
Save jbaxleyiii/6771b0f46f31b49c5e1355cd0f5bd3ed 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 MOVIE_QUERY = gql` | |
query GetMovie($id: Int!) { | |
movie(id: $id) { | |
id | |
title | |
overview | |
poster_path | |
} | |
} | |
`; | |
function MovieInfo({ movie, clearActiveResult }) { | |
return ( | |
<Query asyncMode query={MOVIE_QUERY} variables={{ id: movie.id }}> | |
{({ data: { movie } }) => ( | |
<Fragment> | |
<FullPoster movie={movie} /> | |
<h2>{movie.title}</h2> | |
<div>{movie.overview}</div> | |
</Fragment> | |
)} | |
</Query> | |
); | |
} |
Apparently Query component (among Mutation and Subscriptions) is part of React Apollo, but honestly I did not see that documented anywhere. I ended up writing my own render prop wrapper around graphql
HoC.
@jbaxleyiii is there some documentation of those components or is it still experimental?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the component ?