reset
Resets the entire form, several fields and field arrays or a single field or field array.
// Reset the entire form
reset(form, options);
// Reset a single field or field array
reset(form, name, options);
// Reset several fields and field arrays
reset(form, names, options);
Parameters
formFormStorenamestringnamesstring[]optionsobject ={}initialValuesMaybe<InitialValues<>FieldValues>initialValueMaybe<FieldValue>keepResponseboolean =falsekeepSubmitCountboolean =falsekeepSubmittedboolean =falsekeepValuesboolean =falsekeepDirtyValuesboolean =falsekeepItemsboolean =falsekeepDirtyItemsboolean =falsekeepErrorsboolean =falsekeepTouchedboolean =falsekeepDirtyboolean =false
Explanation
In addition to the names of the fields, you can also specify the name of a field array under names or name. In this case, the field array and the fields and field arrays it contains will be reset.
When you reset the entire form or several fields, you can specify new initialValues that override the loader you specified in the useForm hook.
When you reset a single field, you can specify a new initialValue that override the initial value you set in the loader of the useForm hook.
By default, the response, submitCount and submitted state of the form is reset when the entire form is reset. To change this behavior you can set keepResponse, keepSubmitCount and/or keepSubmitted to true.
By default, the value, items, error, touched and dirty state of each field and field array are reset. To change this behavior you can set keepValues, keepDirtyValues, keepItems, keepDirtyItems, keepErrors, keepTouched and/or keepDirty to true.