Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/netzo/deps/react-hook-form.ts>UseFormSetValue

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
type alias UseFormSetValue
import { type UseFormSetValue } from "https://deno.land/x/netzo@0.4.78/deps/react-hook-form.ts";

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

Examples

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>>(
name: TFieldName,
value: FieldPathValue<TFieldValues, TFieldName>,
options?: SetValueConfig,
) => void