Oturum açtıktan sonra kapsayıcıda "LoginPage" (akıllı bileşen) yönlendirmesini kullanmak istiyorum. Böyle şey:Reak-redux, mapStateToProps, MapDispatchToProps ve redux-router ile nasıl bağlanır
handleSubmit(username, pass, nextPath) {
function redirect() {
this.props.pushState(null, nextPath);
}
this.props.login(username, pass, redirect); //action from LoginAcitons
}
kullanıcı adı ve dilsiz-bileşeninden geldi geçiren.
Akıllı bileşen ben redux-yönlendiricinizden pushState ekleyebilir nasıl
function mapStateToProps(state) {
return {
user: state.app.user
};
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(LoginActions, dispatch)
}
bağlamak? Yoksa yanlış yolda mıyım?
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
Ben benzer bir sorun şaşırıp. Burada LoginActions nelerdir? –
Bunun neden bileşenin kendisinde yapılması gerekiyor? Sadece merak. – xckpd7