[英]Combining field values with redux-form v6
I'm migrating part of an application from redux-form v5
to v6
( alpha-10
). 我正在将应用程序的一部分从
redux-form v5
迁移到v6
( alpha-10
)。 I need to display the combined values of some fields. 我需要显示某些字段的组合值。
In v5
, I would have something like: 在
v5
,我会有类似以下内容:
class MyForm extends Component {
render() {
const { fields: { first, last }, handleSubmit } = this.props
return (
<form onSubmit={handleSubmit}>
<div>
<label>First name</label>
<input type="text" {...first}/>
</div>
<div>
<label>Last name</label>
<input type="text" {...last}/>
</div>
<div>
Welcome {first.value last.value.toUpperCase()}
</div>
<button type="submit">Submit</button>
</form>
)
}
}
The last div
of the form combines the values of my two first
and last
fields. 表格的最后一个
div
合并了我的两个first
和last
字段的值。 How can I create such an element with v6
? 如何使用
v6
创建这样的元素?
Just published an API for this exact thing. 刚刚发布了有关此确切内容的API。 Check out the Selecting Form Values example.
查看“ 选择表单值”示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.