Created
October 21, 2018 07:39
-
-
Save jepras/3c93df45d6cb9bd14e187055f8201f91 to your computer and use it in GitHub Desktop.
mapDispatchToProps takes the dispatch function as a parameter and then returns that function with the property of the addMessage action creator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const addMessage = (message) => { | |
return { | |
type: 'ADD', | |
message: message | |
} | |
}; | |
// change code below this line | |
const mapDispatchToProps = dispatch => { | |
return { | |
submitNewMessage: function(message) { | |
dispatch(addMessage(message)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment