import { type UseFormSetValue } from "https://deno.land/x/netzo@0.5.63/deps/react-hook-form.ts";
Set a single field value, or a group of fields value.
Examples
Example 1
Example 1
// Update a single field
setValue('name', 'value', {
shouldValidate: true, // trigger validation
shouldTouch: true, // update touched fields form state
shouldDirty: true, // update dirty and dirty fields form state
});
// Update a group fields
setValue('root', {
a: 'test', // setValue('root.a', 'data')
b: 'test1', // setValue('root.b', 'data')
});
// Update a nested object field
setValue('select', { label: 'test', value: 'Test' });
Type Parameters
TFieldValues extends FieldValues
definition: <TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>() => void