Files

30 lines
443 B
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Map Dispatch to Props
---
# Map Dispatch to Props
2018-10-12 15:37:13 -04:00
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```jsx
const addMessage = (message) => {
return {
type: 'ADD',
message: message
}
};
2018-10-12 15:37:13 -04:00
// change code below this line
const mapDispatchToProps = (dispatch) => {
return {
submitNewMessage: (message)=>{
dispatch(addMessage(message))
}
}
}
```
</details>