79
rated 0 times
[
83]
[
4]
/ answers: 1 / hits: 46561
/ 9 Years ago, thu, december 24, 2015, 12:00:00
I want to use in my container LoginPage (smart-component) redirect after login.
Something like this:
handleSubmit(username, pass, nextPath) {
function redirect() {
this.props.pushState(null, nextPath);
}
this.props.login(username, pass, redirect); //action from LoginAcitons
}
username and pass arrived from dumb-component.
Smart component connect
function mapStateToProps(state) {
return {
user: state.app.user
};
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(LoginActions, dispatch)
}
How I can add pushState from redux-router ? Or I'm on wrong way?
export default connect(mapStateToProps, {pushState})(LoginPage); //works, but haven't actions
export default connect(mapStateToProps, mapDispatchToProps)(LoginPage); //works, but haven't pushState
export default connect(mapStateToProps, mapDispatchToProps, {pushState})(LoginPage); //Uncaught TypeError: finalMergeProps is not a function
More From » reactjs