import React, { Component } from 'react' import { graphql, gql, compose } from 'react-apollo' import { SINGLE_ITEM_QUERY } from '../queries'; import withData from '../lib/withData'; class Item extends Component { render() { if(!this.props.findItem.Item) return

Not ready

console.log(this.props.findItem.Item); if(this.props.loading) return

Loading...

if(this.props.error) return

Error...

const item = this.props.findItem.Item; return (

Viewing {item.title}

) } } const ComponentWithMutations = compose( graphql(SINGLE_ITEM_QUERY, { name: 'findItem', // This comes from Props options: ({ id }) => ({ variables: { id } }) }) )(Item); export default ComponentWithMutations;