Skip to content

Instantly share code, notes, and snippets.

@astrotim astrotim/Home.js
Last active Dec 29, 2017

What would you like to do?
updated with Contentful API call
import React from 'react';
import { createClient } from 'contentful';
class Home extends React.Component {
state = {
posts: []
componentWillMount() {
const client = createClient({
space: process.env.REACT_APP_SPACE_ID,
accessToken: process.env.REACT_APP_ACCESS_TOKEN
.then(response => {
posts: response.items
render() {
if (!this.state.posts.length) return <p>No posts found.</p>;
return => {
return <p>Post</p>;
export default Home;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.