Tell us what’s happening:
I m getting the following error message. However in my test code (two console.log statement at the bottom), it shows the code is able to return a message to the dispatch function. I am not sure what I am missing here.
“Dispatching addMessage with submitNewMessage from mapDispatchToProps should return a message to the dispatch function.”
Your code so far
const addMessage = (message) => {
return {
type: 'ADD',
message: message
}
};
// change code below this line
function mapDispatchToProps(dispatch ) {
return {
submitNewMessage :dispatch
};
}
console.log( addMessage('msg1').message );
console.log( mapDispatchToProps(addMessage).submitNewMessage('msg2').message );
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
.
Link to the challenge: