Submit and reset
submit(onValid, onInvalid) validates the form, increments submitCount, and calls the appropriate callback. While validation or onValid is pending, isSubmitting is true. On completion, isSubmitted is true and isSubmitSuccessful reports whether the valid callback completed successfully. The promise resolves to the value returned by onValid, resolves to undefined when validation fails, and rejects when onValid throws or rejects.
await form.submit(
async (values) => {
await api.save(values);
form.reset(values);
},
(fields) => {
console.warn('invalid fields', fields);
},
);reset() restores the current defaultValues. reset(nextValues) replaces that baseline and clears field metadata around the new values. The optional ResetOptions can preserve dirty values, errors, touched flags, or submit state with keepDirtyValues, keepErrors, keepTouched, and keepSubmitState. Combine submit, setErrors, and clearErrors for server flows: submit valid client values, map server errors to fields, clear those errors when the user changes or retries.
Practical guidance
Keep this page near the source when you build abstractions. The reference describes what the package exposes, while guides show one way to compose those pieces. If a helper hides FieldPathInput, validation triggers, or array rebasing, document that helper with the same precision so future maintainers know whether strings, tuples, or stable keys are expected.