clearErrors: (name?: string | string[]) => void
This function can manually clear errors in the form.
Props
Type | Description | Example |
---|---|---|
undefined | Remove all errors. | clearErrors() |
string | Remove single error. | clearErrors("yourDetails.firstName") |
string[] | Remove multiple errors. | clearErrors(["yourDetails.lastName"]) |
undefined
: reset all errorsstring
: reset the error on a single field or by key name.string[]
: reset errors on the given fields
Rules
This will not affect the validation rules attached to each inputs.
This method doesn't affect validation rules or
isValid
formState.
Examples
Thank you for your support
If you find React Hook Form to be useful in your project, please consider to star and support it.