繁体   English   中英

redux形式的动态名称不会更改减速器名称

[英]redux-form dynamic name does not change the reducer name

我正在使用这样的redux形式:

 <RenderForm
      form={form.name}
      elements={form.elements}
      initialValues={form.initialValues}
      method={form.method}
      target={form.target}
      validate={parseValidations(form.elements)}
      enableReinitialize
      keepDirtyOnReinitialize
      {...props}
    />

const RenderForm = reduxForm()(Form);

const Form = ({ children, method, target, form, elements, msg, handleSubmit, onChange }) => (
  <form
    onSubmit={handleSubmit}
    id={form && `form-${form}`}
    method={method}
    action={target}
    onChange={onChange}
  >
    { msg ? <IconTooltip
      id={`info-${form.name}`}
      content={msg.p}
      title={msg.h}
      top={30}
      showStart
      showMedium
    /> : null}
    <div>
      {formFactory(elements.filter(e => !e.noBackground))}
    </div>
    <div>
      {formFactory(elements.filter(e => e.noBackground))}
    </div>
    {children}
  </form>
);

现在我的问题是-表单名称更改时,它不会更改redux中的reducer。

例如,我在向导的第1步中有一个向导和名为category的表单->现在,我更改为向导的第2步,并且有一个名为amount的表单。 它将始终保持类别。

如何解决这个问题?

您是否已在http://redux-form.com/6.6.3/examples/wizard/上阅读了有关如何构建向导表单的文档?

文档中提到,如果要构建向导,则需要将向导的每个页面连接到相同的表单名称,因此需要显式指定。

也许可以解决您的问题?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM