type FormState<TFormData>: object;
An object representing the current state of the form.
• TFormData
canSubmit: boolean;
A boolean indicating if the form can be submitted based on its current state.
errorMap: FormValidationErrorMap;
The error map for the form itself.
errors: ValidationError[];
The error array for the form itself.
fieldMeta: Record<DeepKeys<TFormData>, FieldMeta>;
A record of field metadata for each field in the form.
isBlurred: boolean;
A boolean indicating if any of the form fields have been blurred.
isDirty: boolean;
A boolean indicating if any of the form's fields' values have been modified by the user. True
if the user have modified at least one of the fields. Opposite of isPristine
.
isFieldsValid: boolean;
A boolean indicating if all the form fields are valid.
isFieldsValidating: boolean;
A boolean indicating if any of the form fields are currently validating.
isFormValid: boolean;
A boolean indicating if the form is valid.
isFormValidating: boolean;
A boolean indicating if the form is currently validating.
isPristine: boolean;
A boolean indicating if none of the form's fields' values have been modified by the user. True
if the user have not modified any of the fields. Opposite of isDirty
.
isSubmitted: boolean;
A boolean indicating if the form has been submitted.
isSubmitting: boolean;
A boolean indicating if the form is currently in the process of being submitted after handleSubmit
is called.
Goes back to false
when submission completes for one of the following reasons:
onSubmit
function has completed.Note: if you're running async operations in your onSubmit
function make sure to await them to ensure isSubmitting
is set to false
only when the async operation completes.
This is useful for displaying loading indicators or disabling form inputs during submission.
isTouched: boolean;
A boolean indicating if any of the form fields have been touched.
isValid: boolean;
A boolean indicating if the form and all its fields are valid.
isValidating: boolean;
A boolean indicating if the form or any of its fields are currently validating.
submissionAttempts: number;
A counter for tracking the number of submission attempts.
validationMetaMap: Record<ValidationErrorMapKeys, ValidationMeta | undefined>;
An internal mechanism used for keeping track of validation logic in a form.
values: TFormData;
The current values of the form fields.
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.