Skip to content
This repository was archived by the owner on Jul 7, 2021. It is now read-only.

Commit 9655587

Browse files
committed
create mapStateToProps function in Posts component
1 parent 5c70add commit 9655587

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/Posts.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ class Posts extends Component {
2727
}
2828
}
2929

30-
export default connect(null, { fetchPosts })(Posts);
30+
const mapStateToProps = (state) => ({
31+
posts: state.posts.items, // here we used key posts because we used the same key in rootReducer
32+
});
33+
34+
export default connect(mapStateToProps, { fetchPosts })(Posts);

0 commit comments

Comments
 (0)