0 points

Map Dispatch to Props


dashboard

Thu Nov 12 2020 23:54:08 GMT+0000 (UTC)

Posted by @bifrost #react.js

const addMessage = (message) => {
  return {
    type: 'ADD',
    message: message
  }
};

// change code below this line
const mapDispatchToProps = (dispatch) => {
    return {
        submitNewMessage: (message)=>{
            dispatch(addMessage(message))
        }
    }
}
content_copy Copy