Using <Cotroller /> for object fields #11463
-
I have a simple form with default values set as follows: const methods = useForm({
defaultValues: {
car: {
name: "",
model: "",
},
},
}); My component renders two inputs using I simulated this process by rendering a simple button that sets the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It would help if you fix const handleSetFields = () => {
setValue("car.name", "Ford")
setValue("car.model", "Mustang");
}; |
Beta Was this translation helpful? Give feedback.
It would help if you fix
handleSetFields
to update fields individually to make each controller see the changes.<Controller name="car.model">
doesn't knowcar
object has changed. It only detects field changes.