Skip to content

Instantly share code, notes, and snippets.

@akoenig
Created March 4, 2018 07:38
Show Gist options
  • Save akoenig/6b062df80ee7864cbbfce719dc04dc70 to your computer and use it in GitHub Desktop.
Save akoenig/6b062df80ee7864cbbfce719dc04dc70 to your computer and use it in GitHub Desktop.
import { compose } from "recompose";
import { graphql, gql } from "react-apollo";
import { ErrorHandler } from "./components";
const NewsList = compose(
graphql(gql`
query news {
id
name
}
`)
)(({ data }) =>
<div>
{data.loading ? (
<span>Loading ...</span>
) : data.errors ? (
<ErrorHandler errors={data.errors} />
) : (
<ul>
data.news.map(entry => <li key={entry.id}>{entry.name}</li>)
</ul>
)}
</div>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment