此react-final-form组件将返回以下结果
<Field
name="answers[0].name"
component="input"
type="radio"
value="0"
/>
{ answers: [ { name: 'value' } ] } 如何添加另一个属性?它将会像这样结束
{ answers: [ { name: 'user input value will here', other: 'my custom data' } ] } 根据final-form,你可以用4种方式命名你的字段组件

发布于 2021-01-28 03:06:44
您可以将initialValues属性添加到表单中,该属性将预先填充结果。
<Form
onSubmit={onSubmit}
initialValues={{
answers: [ { other: 'your custom data' } ]
}}
>
<Field
name="answers[0].name"
component="input"
type="text"
/>
</Form>https://stackoverflow.com/questions/65915172
复制相似问题