Last active
March 6, 2020 10:44
-
-
Save raphael-brand/f4516553a7e763455e4d83ba2441dc35 to your computer and use it in GitHub Desktop.
React.js and GraphQL
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
@graphql(gql` | |
query { | |
todos { | |
title | |
date | |
} | |
} | |
`); | |
class Todos extends Component { | |
render() { | |
const {data: {status, todos}} = this.props; | |
{ | |
!status.ok ? <div> { status.message } </div> : <ul> | |
{todos.map(todo => <li>{ todo.title } - { todo.date }</li>)} | |
</ul> | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment