Skip to content

Instantly share code, notes, and snippets.

@youknowriad
Last active January 7, 2017 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youknowriad/ef68cc0b9d5c7e87668e0f68d6f21b11 to your computer and use it in GitHub Desktop.
Save youknowriad/ef68cc0b9d5c7e87668e0f68d6f21b11 to your computer and use it in GitHub Desktop.
React Component using a query HoC
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