There is a good option: connect using actions *
import * as actions toolbar from '../actions/actions toolbar'
...
const mapDispatchToProps = (dispatch) => {
return {
actions toolbar: bindActionCreators(actions toolbar, dispatch)
}
}
In this case, all actions of the user (namely, all functions that are exported from the file actions toolbar) will be available from
this.props.actions toolbar (for example, this.props.actions toolbar.saveUser)
Also, you can not write return, if you return an object (just our case)
const mapDispatchToProps = (dispatch) => ({
actions toolbar: bindActionCreators(actions toolbar, dispatch)
})
Pay attention to parentheses.
absolutely equal ?
Why in such cases do we need it? - danny43 commented on July 8th 19 at 12:05