Until now I used my containers and components actions this way:
<Header btnMnuAction={this.props.toggleSidebar} logout={this.props.logout}/>
With the mapDispatchToProps function:
const mapDispatchToProps = (dispatch) => {
return {
toggleSidebar: () => {
dispatch(toggleSidebar());
},
logout: () => {
dispatch(logout());
}
}
};
Now I tried it this way:
<Header btnMnuAction={() => this.props.dispatch(toggleSidebar())} logout={() => this.props.dispatch(logout())} >
Please, can someone explain to me what's the difference between these options?
Thanks :)