Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Go to Latest
type alias UseFormReset
import { type UseFormReset } from "https://deno.land/x/netzo@0.3.66/deps/react-hook-form.ts";

Reset at the entire form state.

Examples

Example 1

useEffect(() => {
  // reset the entire form after component mount or form defaultValues is ready
  reset({
    fieldA: "test"
    fieldB: "test"
  });
}, [reset])

// reset by combine with existing form values
reset({
  ...getValues(),
 fieldB: "test"
});

// reset and keep form state
reset({
  ...getValues(),
}, {
  keepErrors: true,
  keepDirty: true
});

Type Parameters

TFieldValues extends FieldValues
definition: (values?: DefaultValues<TFieldValues> | TFieldValues | ResetAction<TFieldValues>, keepStateOptions?: KeepStateOptions) => void