Last active
April 6, 2017 02:09
-
-
Save ColeTownsend/255dd5af2307fa9569d532c37a6ca9b8 to your computer and use it in GitHub Desktop.
Index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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