Skip to content

Instantly share code, notes, and snippets.

@r3-yamauchi
Last active December 11, 2017 21:08
Show Gist options
  • Save r3-yamauchi/01aea63970fd106797c9225353ca3050 to your computer and use it in GitHub Desktop.
Save r3-yamauchi/01aea63970fd106797c9225353ca3050 to your computer and use it in GitHub Desktop.
kintone から GRAPHCOOL にアクセスする https://blog.r3it.com/kintone-to-graphcool-852f7c305a49
import React from "react";
import gql from "graphql-tag";
import { graphql } from "react-apollo";
const ArticleItem = ({ article }) => (
<li style={{ width: 600 }}>
<h3>{article.title}</h3>
</li>
);
const ArticleList = ({ data: { loading, error, allArticles } }) => (
loading ? <p>ロードしています...</p> :
error ? <p>Error: {error}</p> : (
<ul style={{ listStyleType: "none", padding: 0 }}>
{allArticles.map(article => <ArticleItem key={article.id} article={article} />)}
</ul>
)
);
const query = gql`
{
allArticles(orderBy:updatedAt_DESC) {
id
title
}
}
`;
export default graphql(query)(ArticleList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment