使用redux-form 6在onSubmit事件处理程序中缺少此项

Ali*_*ian 5 reactjs redux-form

我试图使用我的componentsnet props用redux-form 6.1.1在submit事件处理程序中调用一个动作,但是在事件处理函数中我得到了"this" is undefined.这是我做的:

class ForgetPasswordForm extends Component {
  xubmit (values) {
    console.log(this);
  }

  render() {
    const { handleSubmit } = this.props;
    return (
      <form onSubmit={ handleSubmit(this.xubmit) }>
      ...
    );
  };
}
Run Code Online (Sandbox Code Playgroud)

我也试过() => handleSubmit(this.xubmit.bind(this))this.xubmit.bind(this)React中提到:在事件处理程序中这是null,但它们都没有成功.

以下是有关我的设置的详细信息:

  • 样板:create-react-app v.0.5
  • 反应:第15.3.2节
  • redux:v.3.6