Answer the question
In order to leave comments, you need to log in
What's the point of bindActionCreators?
After reading the documentation, I did not understand the sacred meaning of this function.
Why write like this?
function mapDispatchToProps(dispatch) {
return bindActionCreators({ selectBook: selectBook }, dispatch);
}
export default connect(mapStateToProps, mapDispatchToProps)(BookList);
let mapDispatchToProps = {selectBook};
export default connect(mapStateToProps, mapDispatchToProps)(BookList);
Answer the question
In order to leave comments, you need to log in
bindActionCreators is in the redux module , while shorthand mapDispatchToProps is in the react-redux module .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question