3 ms·
Sure. Also, just as an FYI, because a large number of people aren't aware this is possible: you can pass an object full of action creators to `connect` instea
by acemarke 8y ago
Sure. Also, just as an FYI, because a large number of people aren't aware this is possible: you can pass an object full of action creators to `connect` instead of a `mapDispatch` function. This simplifies the use of `connect`, like:
export default connect(mapState, {addTodo, toggleTodo})(TodoList);
We're about to add a whole big section on dispatching and action creators to our new React-Redux docs site at https://react-redux.js.org https://react-redux.js.org - keep an eye out for that. Until then, check out Dave Ceddia's post at https://daveceddia.com/redux-mapdispatchtoprops-object-form/ https://daveceddia.com/redux-mapdispatchtoprops-object-form/ for an explanation.