使用React-hook-form的useFieldArray点击append时如何得到空字段?

How can I get an empty field when I click on the append using the useFieldArray of React-hook-form?

每当我点击附加按钮时,生成的字段值打印为 [object object] 但我想得到一个空白字段。 我想这样输出:"fieldName" : ["value1","value2"...n]。 在这段代码中,我得到了我喜欢的输出,但每次我都必须删除附加字段中打印的 [object obejct]

代码 link : https://codesandbox.io/s/practical-star-jif19c?file=/src/index.js:162-177

由于您的数组仅包含原始名称而不包含原始对象,因此您应该将 "" 放入 append 函数而不是 {} 对象。

<Button
    variant="contained"
    component="label"
    type="button"
    onClick={() => append('')}
>
    Add Items
</Button>