diff --git a/src/useSubmit.ts b/src/useSubmit.ts index e427424..229860b 100644 --- a/src/useSubmit.ts +++ b/src/useSubmit.ts @@ -21,9 +21,10 @@ type SubmitFn = (values: T) => void | Promise; export function useSubmit( form: Form, fn: SubmitFn, - opts: ValidateOptions = { touch: true } + opts: ValidateOptions = {} ): Submit { const isMounted = useMounted(); + const { touch = true } = opts; return useEventCallback((event?: FormEvent) => { if (event) { @@ -37,7 +38,7 @@ export function useSubmit( form.setSubmitting(true); - return toPromise(() => form.validate(opts)) + return toPromise(() => form.validate({ touch })) .then(result => { if (!result.valid) return;