Update CommentsRedux2.md

master
Matt Huntington 8 years ago committed by GitHub
parent 772d0d4799
commit 98744c6ed6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -94,7 +94,7 @@ Now create a function that will map a dispatch to a property in `js/components/c
```javascript ```javascript
const mapDispatchToProps = function(dispatch){ const mapDispatchToProps = function(dispatch){
return { return {
handleSubmit: function(comment){ createComment: function(comment){
dispatch({type:'ADD', comment: comment }); dispatch({type:'ADD', comment: comment });
} }
} }
@ -116,12 +116,12 @@ Export the `VisibleCommentsForm` component:
export default VisibleCommentsForm; export default VisibleCommentsForm;
``` ```
Refactor `handleSubmit` to use the `handleSubmit` component prop: Refactor `handleSubmit` to use the `createComment` component prop:
```javascript ```javascript
handleSubmit(event){ handleSubmit(event){
event.preventDefault(); event.preventDefault();
this.props.handleSubmit({ this.props.createComment({
body: this.refs.body.value, body: this.refs.body.value,
author: this.refs.author.value author: this.refs.author.value
}); });

Loading…
Cancel
Save