WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 798fa3a

Browse files
authored
Merge pull request #107 from raulfdm/main
Make event on handleSubmit function optional to match react-hook-form
2 parents 6bc677d + 063c0a7 commit 798fa3a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/hook/index.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ import {
1818
type SubmitErrorHandler,
1919
type SubmitHandler,
2020
useFormContext,
21+
useForm,
22+
FormProvider,
23+
type DefaultValues,
24+
type FieldValues,
25+
type FormState,
26+
type KeepStateOptions,
27+
type Path,
28+
type RegisterOptions,
29+
type UseFormHandleSubmit,
30+
type UseFormProps,
31+
type UseFormReturn,
2132
} from "react-hook-form";
22-
import { useForm, FormProvider } from "react-hook-form";
23-
import type {
24-
DefaultValues,
25-
FieldValues,
26-
FormState,
27-
KeepStateOptions,
28-
Path,
29-
RegisterOptions,
30-
UseFormHandleSubmit,
31-
UseFormProps,
32-
UseFormReturn,
33-
} from "react-hook-form";
33+
3434
import { createFormData } from "../utilities";
3535

3636
export type SubmitFunctionOptions = Parameters<SubmitFunction>[1];
@@ -189,7 +189,7 @@ export const useRemixForm = <T extends FieldValues>({
189189
);
190190

191191
const handleSubmit = useMemo(
192-
() => (e: FormEvent<HTMLFormElement>) => {
192+
() => (e?: FormEvent<HTMLFormElement>) => {
193193
const encType = e?.currentTarget?.enctype as FormEncType | undefined;
194194
const method = e?.currentTarget?.method as FormMethod | undefined;
195195
const onValidHandler = submitHandlers?.onValid ?? onSubmit;

0 commit comments

Comments
 (0)