Created
August 10, 2017 17:34
-
-
Save aofleejay/632b83d9c2925846a7fffb83439c071a to your computer and use it in GitHub Desktop.
Apollo-client query handling
This file contains hidden or 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
class Gallery extends Component { | |
render() { | |
const { loading, error, allImages } = this.props.data | |
if (loading) return <Loading /> | |
else if (error) return <Error /> | |
return ( | |
<div> | |
{ | |
allImages.map(image => <img key={image.id} src={image.url} />) | |
} | |
</div> | |
) | |
} | |
} | |
export default graphql(query)(Gallery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment