Skip to content

Instantly share code, notes, and snippets.

@manoelneto
Created October 6, 2018 13:39
Show Gist options
  • Save manoelneto/ee0381d60f77a6cbb04931bdab6b3928 to your computer and use it in GitHub Desktop.
Save manoelneto/ee0381d60f77a6cbb04931bdab6b3928 to your computer and use it in GitHub Desktop.
const PostList = ({posts}) => (
posts.map(post => <Post post={post} />)
)
class App extends Component {
state = {
posts: []
}
componentDidMount() {
this.fetchPost().then(posts => this.setState({posts}))
}
render() {
return <PostList posts={this.state.posts}>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment