import React from 'react'; import { useForm, Control, useWatch, Controller } from 'react-hook-form'; import { useRef } from 'react'; type FormInputs = { test: string; test1: string; test2: string; }; let counter = 0; const GrandChild = ({ control, index = 0, }: { control: Control; index?: number; }) => { const counter1 = useRef(0); const output = useWatch({ name: 'test', control, }); counter1.current++; return (

Grandchild 0:

{output}

Render counter: {counter1.current}

); }; const GrandChild1 = ({ control }: { control: Control }) => { const counter = useRef(0); const output = useWatch({ name: ['test', 'test1'], control, }); counter.current++; return (

Grandchild 1:

{output[0]} {output[1]}

Render counter: {counter.current}

); }; const GrandChild2 = ({ control, }: { control: Control<{ test: string; test1: string; test2: string; }>; }) => { const counter = useRef(0); const output = useWatch<{ test: string; test1: string; test2: string; }>({ control, }); counter.current++; return (

Grandchild 2:

{output.test} {output.test1} {output.test2}

Render counter: {counter.current}

); }; const Child = ({ control }: { control: Control }) => { const counter1 = useRef(0); counter1.current++; return (

Child:

Render counter: {counter1.current} 👀

); }; export default () => { const { register, control } = useForm(); counter++; return (

Parent:

( )} defaultValue="" />

Render counter: {counter} 👀

); };