({
index,
control,
}: {
control: Control<FormData>;
index: number;
})
| 13 | }; |
| 14 | }; |
| 15 | const ChildComponent = ({ |
| 16 | index, |
| 17 | control, |
| 18 | }: { |
| 19 | control: Control<FormData>; |
| 20 | index: number; |
| 21 | }) => { |
| 22 | const { fields } = useFieldArray<FormData>({ |
| 23 | name: `nest.test.${index}.nestedArray` as const, |
| 24 | control, |
| 25 | }); |
| 26 | |
| 27 | return ( |
| 28 | <div> |
| 29 | {fields.map((item, i) => ( |
| 30 | <input |
| 31 | key={item.id} |
| 32 | {...control.register( |
| 33 | `nest.test.${index}.nestedArray.${i}.value` as const, |
| 34 | )} |
| 35 | /> |
| 36 | ))} |
| 37 | </div> |
| 38 | ); |
| 39 | }; |
| 40 | |
| 41 | const Component = () => { |
| 42 | const { register, control } = useForm({ |
nothing calls this directly
no test coverage detected