Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

UseFormSetValue

Set a single field value, or a group of fields value.

@example
// 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 UseFormSetValue<TFieldValues extends FieldValues> = <TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(
name: TFieldName,
value: FieldPathValue<TFieldValues, TFieldName>,
options?: SetValueConfig,
) => void
;

§Type Parameters

§
TFieldValues extends FieldValues
[src]

§Type

§
<TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(name: TFieldName, value: FieldPathValue<TFieldValues, TFieldName>, options?: SetValueConfig) => void
[src]