Answer the question
In order to leave comments, you need to log in
How to connect mapDispatchToProps?
I did it like this, but I still need to pass login to connect how to do it?
import { hideModal, showModal, login } from '../../actions';
const mapStateToProps = state => ({
isAuthenticated: !!state.user.token
});
const mapDispatchToProps = dispatch => ({
handleClose: () => {
dispatch(hideModal());
},
showRegister: () => {
dispatch(showModal('REGISTER', {}));
},
showForgot: () => {
dispatch(showModal('FORGOT', {}));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(LoginModal);
export default connect(
mapStateToProps,
mapDispatchToProps,
{ login }
)(LoginModal);
Answer the question
In order to leave comments, you need to log in
import { hideModal, showModal, login } from '../../actions';
const mapStateToProps = state => ({
isAuthenticated: !!state.user.token
});
const mapDispatchToProps = dispatch => ({
handleClose: () => {
dispatch(hideModal());
},
showRegister: () => {
dispatch(showModal('REGISTER', {}));
},
showForgot: () => {
dispatch(showModal('FORGOT', {}));
},
login: () => {
dispatch(login('....'))
}
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(LoginModal);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question