Skip to content

Instantly share code, notes, and snippets.

@jbaxleyiii
Last active March 3, 2018 10:50
Show Gist options
  • Save jbaxleyiii/6771b0f46f31b49c5e1355cd0f5bd3ed to your computer and use it in GitHub Desktop.
Save jbaxleyiii/6771b0f46f31b49c5e1355cd0f5bd3ed to your computer and use it in GitHub Desktop.
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>
);
}
@vnctaing
Copy link

vnctaing commented Mar 2, 2018

What is the component ?

@danielkcz
Copy link

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