Created
May 5, 2017 13:48
-
-
Save kishanio/8265cc1edaf3e56b4ec8a837a1f2e384 to your computer and use it in GitHub Desktop.
Redux : Map Dispatch Props Shorthand
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mapDispatchToProps = (dispatch) => ({ | |
onTodoClick(id) { | |
dispatch(toggleTodo(id)); | |
}, | |
}); | |
const VisibleTodoList = withRouter( connect( | |
mapStateToProps, | |
mapDispatchToProps | |
)(TodoList) ); | |
// can be re written as. | |
const VisibleTodoList = withRouter( connect( | |
mapStateToProps, | |
{ onTodoClick: toggleTodo } | |
)(TodoList) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment