showing results for - "mapdispatchtoprops"
Maia
31 Apr 2017
1const mapDispatchToProps = (dispatch) => {
2  return {
3    // dispatching plain actions
4    increment: () => dispatch({ type: 'INCREMENT' }),
5    decrement: () => dispatch({ type: 'DECREMENT' }),
6    reset: () => dispatch({ type: 'RESET' }),
7  }
8}
9
10⭐ Note: We recommend using the object form of 
11mapDispatchToProps unless you specifically 
12need to customize dispatching behavior in some way.
Michael
28 Aug 2018
1
2function mapDispatchToProps(dispatch){
3return{submitNewMessage: function(add){
4    dispatch(addMessage(add))}
5  }
6}
7
Lennard
25 Jul 2018
1const mapDispatchToProps = (dispatch) => {
2  return {
3    onTodoClick: (id) => {
4      dispatch(toggleTodo(id))
5    }
6  }
7}