在redux-from中选择表单值

时间:2019-03-18 09:21:56

标签: javascript reactjs redux redux-form

当我使用redux-from单击单选按钮时,我想显示表格,这是我的教程链接,(使用复选框的实现)  selectingformvalues,但我无法在单选按钮上实现它,

我有2个单选按钮

单选按钮 x 单击,显示 a 表单

单选按钮 y 单击,显示 b 表单并隐藏 a 表单

    <label htmlFor="hasEmail">percentage</label>
    <div>
      <Field
        name="taxtype"
        component="input"
        type="radio"
        value="percentage"
      />
    </div>
  </div>
  <div>
    <label htmlFor="hasEmail">usd</label>
    <div>
      <Field
        name="taxtype"
        component="input"
        type="radio"
        value="usd"
      />
    </div>
  </div>
  {usd && (
    <div>
      <label>Email</label>
      <div>
        <Field
          name="email"
          component="input"
          type="email"
          placeholder="Email"

        />
      </div>
    </div>
  )}

  {percentage && (
    <div>
      <label>Email 2</label>
      <div>
        <Field
          name="email"
          component="input"
          type="email"
          placeholder="Email"

        />
      </div>
    </div>
  )}



 const percentage = selector(state, 'percentage')
  const usd = selector(state, 'usd')

1 个答案:

答案 0 :(得分:0)

这是您引用的示例,您重写了该示例以包括两个收音机

https://codesandbox.io/s/koz449qo6o