我正在使用Redux表单开发表单构建器。我试图在handleSubmit函数内部提交后更改FormSection的值,但它也影响Redux Form Field存储。也只有在我使用FormSection功能时才会发生。
onSubmit = (values) => {
const data = {
...values
}
// Here i'm overwrite first_name field, its placed in FormSection
data.profile.first_name = "Ashwin";
// After doing this its affecting Redux field store. in browser
view also showing same name
}
render () {
<Form onSubmit={this.props.handleSubmit(this.onSubmit)}>
<FormSection name="profile">
<Field name="first_name" component="input" />
</FormSection>
</Form>
}
预期的行为-Redux字段存储不应基于我们在onSubmit函数中所做的事情而更改。