如果我覆盖任何值,则提交后Redux Form FormSection的值将更改。影响其现场商店

时间:2019-05-08 08:52:39

标签: reactjs redux redux-form react-redux-form

我正在使用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函数中所做的事情而更改。

0 个答案:

没有答案