import React from 'react' import { gql, graphql } from 'react-apollo' import PostUpvoter from './PostUpvoter' function Post ({ id, data: { loading, error, Post } }) { return (

{Post.title}

ID: {Post.id}
URL: {Post.url}

) } const post = gql` query post($id: ID!) { Post(id: $id) { id title votes url createdAt } } ` // The `graphql` wrapper executes a GraphQL query and makes the results // available on the `data` prop of the wrapped component (PostList) // Tip: ownProps is parent component's props export default graphql(post, { options: (ownProps) => { return { variables: { id: ownProps.id } } } })(Post)