Created
April 14, 2017 02:09
-
-
Save Tin-Nguyen/9157d27f90a0c71f554c54a611a0e2a7 to your computer and use it in GitHub Desktop.
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
const LatestPostsComponent = props => { | |
const postPreviews = renderPostPreviews(props.posts); | |
return ( | |
<section> | |
<div><h1>Latest posts</h1></div> | |
<div> | |
{ postPreviews } | |
</div> | |
</section> | |
); | |
}; | |
const renderPostPreviews = posts => ( | |
posts.map(post => this.renderPostPreview(post)) | |
); | |
const renderPostPreview = post => ( | |
<article> | |
<h3><a href={`/post/${post.slug}`}>{post.title}</a></h3> | |
<time pubdate><em>{post.posted}</em></time> | |
<div> | |
<span>{post.blurb}</span> | |
<a href={`/post/${post.slug}`}>Read more...</a> | |
</div> | |
</article> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment