MCPcopy Create free account
hub / github.com/react-hook-form/react-hook-form / ChildComponent

Function ChildComponent

app/src/test.tsx:15–39  ·  view source on GitHub ↗
({
  index,
  control,
}: {
  control: Control<FormData>;
  index: number;
})

Source from the content-addressed store, hash-verified

13 };
14};
15const 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
41const Component = () => {
42 const { register, control } = useForm({

Callers

nothing calls this directly

Calls 1

useFieldArrayFunction · 0.85

Tested by

no test coverage detected