pappu
pappu
TTCTheo's Typesafe Cult
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 5/18/2024 in #questions
shadcn/ui page reloads on form submit
If you preventDefault and then void the function call everything works great. I have it as this:
<Form {...form}>
<form
onSubmit={(e) => {
e.preventDefault();
void form.handleSubmit(onSubmit)();
}}

...

const onSubmit = (submission: z.infer<typeof formSchema>) => {
<Form {...form}>
<form
onSubmit={(e) => {
e.preventDefault();
void form.handleSubmit(onSubmit)();
}}

...

const onSubmit = (submission: z.infer<typeof formSchema>) => {
7 replies