diff --git a/src/components/PostList.js b/src/components/PostList.js
index 450a449..24e8805 100644
--- a/src/components/PostList.js
+++ b/src/components/PostList.js
@@ -7,52 +7,52 @@ import { Link } from 'react-router-dom';
class PostList extends React.Component {
- componentDidMount() {
- this.props.fetchPosts();
- }
- renderList() {
- const {posts} = this.props
- const postKeys = Object.keys(posts.entities)
- return postKeys.map(id => {
- const post = posts.entities[id]
- return (
-
-
Blog Posts
-
- {this.renderList()}
-
+ componentDidMount() {
+ this.props.fetchPosts();
+ }
+ renderList() {
+ const {posts} = this.props
+ const postKeys = Object.keys(posts.entities)
+ return postKeys.map(id => {
+ const post = posts.entities[id]
+ return (
+
+
+
+
{post.title}
+
By {post.author}
+
Posted {post.time_published}
+
+
+
- );
- }
+
+
+ );
+ }).reverse();
+ }
+
+
+ render () {
+ return (
+
+
Blog Posts
+
+ {this.renderList()}
+
+
+ );
+ }
}
const mapStateToProps = (state) => {
- return {
- posts: state.posts,
- slug: state.slug
- };
+ return {
+ posts: state.posts,
+ slug: state.slug
+ };
}
export default connect(
- mapStateToProps,
- { fetchPosts }
+ mapStateToProps,
+ { fetchPosts }
)(PostList);