Skip to content

Instantly share code, notes, and snippets.

@ColeTownsend
Last active Apr 6, 2017
Embed
What would you like to do?
Index.js
import React from 'react';
import 'isomorphic-fetch';
import Feed from './components/Feed';
const postEndpoint = `http://twnsndco.dropmark.com/396720.json`;
export default class Index extends React.Component {
static async getInitialProps () {
const response = await fetch(postEndpoint);
const json = await response.json();
return {
data: json.items, // we don't need all of it, just items
};
}
render () {
return (
<main>
<header>
<h1>My design inspiration board</h1>
</header>
<Feed data={this.props.data} />
</main>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment