是否可以使用redux-form,connect和withRouter?

时间:2019-02-03 17:35:27

标签: reactjs redux react-redux redux-form

我正在使用redux-form,connect和router(withRouter)构建登录表单,但是我真的很困惑如何使用这三个方法导出组件:

SignUp = connect(
 mapStateToProps,
 mapDispatchToProps
)(SignUp);

export default withRouter(
 reduxForm({
  form: "registerForm", // a unique identifier for this form
  validate
 })(SignUp)
);

并且以上代码不起作用,因为道具未定义

TypeError:无法读取未定义的属性“ props” handleFormSubmit src / containers / Auth / SignUp.js:43

  40 | 
  41 | handleFormSubmit(formValues) {
  42 |   console.log(formValues);
  43 |   this.props.onAuth(formValues);
     | ^  44 | }
  45 | render() {
  46 |   const { handleSubmit, pristine, reset, submitting } = 
       this.props;

谢谢

0 个答案:

没有答案
相关问题