我使用Redux窗体在我的React应用程序中呈现和处理窗体事件。下面的事情被使用:Redux表单:REGISTER_FIELD/UNREGISTER_FIELD在更改或焦点事件后得到调用
- 初始值
- 领域阵列
- Immutable.js
- 材料UI
此外,场阵列所使用的初始值生成。
export default connect(
state => {
return {
buttonVisible,
confirm,
initialValues: Immutable.Map({
configuration_items: configuration_items,
})
}
}
)(AssetConfiguration)
的问题是,所有表单字段得到注销和每change
或focus
事件注册。没有defaultValues
,它似乎工作正常,但。
我使用一个阵营组件呈现的形式,像这样
class ConfigurationForm extends React.Component {
renderTableBody({ fields, meta: { touched, error } }) {
return(
<tbody>
{fields.map((field, index) => {
return(
<tr key={index}>
<td>
<Field fieldIndex={index} name={`${field}.value`} id={`${field}.value`} component={this.renderItemField.bind(this)} />
</td>
</tr>
)
})}
</tbody>
)
}
render() {
return (
<form className="defaultForm" onSubmit={handleSubmit(postAssetConfiguration)}>
<FieldArray name="configuration_items" component={this.renderTableBody.bind(this)} />
</form>
)
}
}
可能是什么问题就在这里?
感谢, 伦斯