resetField: (name: string, options?: Record<string, boolean | any>) => void
Reset an individual field state.
Props
After invoke this function.
isValid
form state will be reevaluated.isDirty
form state will be reevaluated.
ResetField
has the ability to retain field state. Here are the options you may want to use:
Name | Type | Description | |
---|---|---|---|
name | string | registered field name. | |
options | keepError | boolean | When set to |
keepDirty | boolean | When set to | |
keepTouched | boolean | When set to | |
defaultValue | unknown | When this value is not provided, field will be revert back to it's defaultValue. When this value is provided:
|
Rules
name need to match registered field name.
Examples
Video
The following video tutorial demonstrates resetField
API.
Thank you for your support
If you find React Hook Form to be useful in your project, please consider to star and support it.