Skip to content

Instantly share code, notes, and snippets.

@raphael-brand
Last active March 6, 2020 10:44
Show Gist options
  • Save raphael-brand/f4516553a7e763455e4d83ba2441dc35 to your computer and use it in GitHub Desktop.
Save raphael-brand/f4516553a7e763455e4d83ba2441dc35 to your computer and use it in GitHub Desktop.
React.js and GraphQL
@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