demo
handleSubmit = (e) => {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
console.log('Received values of form: ', values);
}
const { dispatch } = this.props;
dispatch({type:'user/check'});
});
};
...
return (
<Form onSubmit={this.handleSubmit}>
</Form>
);
如果你写成了 onSubmit={()=>this.handleSubmit}
就会报错dispatch is not a function
。
学的很片面,可以参考别人的文章https://blog.csdn.net/hsany330/article/details/90701192
网友评论