Skip to content

Instantly share code, notes, and snippets.

@itinsley
Created May 10, 2019 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itinsley/9ff0c15779402b722d57e0b45572211f to your computer and use it in GitHub Desktop.
Save itinsley/9ff0c15779402b722d57e0b45572211f to your computer and use it in GitHub Desktop.
//container
const mapDispatchToProps=(dispatch)=>{
return {
createComment: async (trackId, commentText, cb)=>{
dispatch(createCommentAction(trackId, commentText)).then(cb);
}
}
}
//Component
this.props.createComment(this.props.trackId, this.state.newComment, this.clearFormState);
clearFormState(){
this.setState({
newComment: '',
loading: false
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment