UseFormReset
Reset at the entire form state.
@example
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 UseFormReset<TFieldValues extends FieldValues> = (values?: DefaultValues<TFieldValues> | TFieldValues | ResetAction<TFieldValues>, keepStateOptions?: KeepStateOptions) => void;
§Type Parameters
§
TFieldValues extends FieldValues
[src]§Type
§
(values?: DefaultValues<TFieldValues> | TFieldValues | ResetAction<TFieldValues>, keepStateOptions?: KeepStateOptions) => void
[src]