Skip to content

Instantly share code, notes, and snippets.

@ColeTownsend
Last active April 6, 2017 02:09
Show Gist options
  • Save ColeTownsend/255dd5af2307fa9569d532c37a6ca9b8 to your computer and use it in GitHub Desktop.
Save ColeTownsend/255dd5af2307fa9569d532c37a6ca9b8 to your computer and use it in GitHub Desktop.
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