-
-
Save youknowriad/ef68cc0b9d5c7e87668e0f68d6f21b11 to your computer and use it in GitHub Desktop.
React Component using a query HoC
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
import React, { Component } from 'react'; | |
import { query } from 'react-graphql-redux'; | |
const TodoList = ( { data: { todos } } ) => { | |
return ( | |
<div> | |
{ todos.map( todo => | |
<Todo key={ todo.id } text={ todo.text } done={ todo.done } /> | |
) } | |
</div> | |
); | |
}; | |
export default query(` | |
{ | |
todos { | |
id | |
text | |
done | |
} | |
) | |
`)( TodoList ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment