Capítulo 8 de 39
control is the opaque connector object useForm() returns for wiring Controller, useController, useWatch, useFieldArray, useFormState, and FormProvider to the same form instance — optional wherever the consuming component already sits inside a FormProvider.
control.register (i.e. anything working with a controlled/third-party input, a watched value, or a field array) needs control unless a FormProvider supplies it implicitly.function App() {
const { control, handleSubmit } = useForm<{ firstName: string }>()
return (
<form onSubmit={handleSubmit((data) => console.log(data))}>
<Controller
render={({ field }) => <input {...field} />}
name="firstName"
control={control}
defaultValue=""
/>
</form>
)
}
control flowing from useForm() straight into Controller.control directly: it's internal-use only; interact with the form exclusively through the documented hooks/components it's passed to.control is the plumbing every controlled-input API (Controller, useController, useWatch, useFieldArray, useFormState) needs, unless a FormProvider is already in place.control as a prop.control through props manually.