Replies: 2 comments 1 reply
-
provide a codesandbox. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Adding An example: type Bar {
something: string
}
type FormValues = {
foo: Bar[]
}
// `useForm`
const { control } = useForm<FormValues>()
// or `useFormContext` if you use `FormProvider`
const { control } = useFormContext<FormValues>()
const { fields } = useFieldArray({ name: 'foo', control })
// => field should be inferred as: Bar & { id: string } by default unless you specify a custom `keyName` |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
According to the documentation, the recommendation is to set the
defaultValue
tofield.value
when iterating over the fieldshttps://react-hook-form.com/api/usefieldarray
but, in testing, I don't see any other properties besides
id
on the field and the TS types don't showvalue
as wellIs something out of date here?
Beta Was this translation helpful? Give feedback.
All reactions