Update CommentsRedux2.md

master
Matt Huntington 8 years ago committed by GitHub
parent 36e8e3f763
commit 0a6e6a66df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -54,7 +54,7 @@ const mapStateToProps = function(state){
In `js/components/commentslist.jsx` connect the mapper with the component: In `js/components/commentslist.jsx` connect the mapper with the component:
```javascript ```javascript
const VisibleCommentsList = connect( const ConnectedComponent = connect(
mapStateToProps mapStateToProps
)(CommentsList); )(CommentsList);
``` ```
@ -62,7 +62,7 @@ const VisibleCommentsList = connect(
In `js/components/commentslist.jsx`, export `VisibleCommentsList`: In `js/components/commentslist.jsx`, export `VisibleCommentsList`:
```javascript ```javascript
export default VisibleCommentsList; export default ConnectedComponent;
``` ```
You can now remove the `constructor`/`componentDidMount` functions and change `this.state.comments.map` to `this.props.comments.map`. We're back to using props instead of component state: You can now remove the `constructor`/`componentDidMount` functions and change `this.state.comments.map` to `this.props.comments.map`. We're back to using props instead of component state:

Loading…
Cancel
Save