When the onSubmit function is executed, the page reloads, preventing the API call within the onSubmit event.
I want to prevent the page from reloading when onSubmit is executed.
In a standard form's onSubmit, executing event.preventDefault() can prevent the page from reloading.
I would like to achieve the same behavior.
When the onSubmit function is executed, the page reloads, preventing the API call within the onSubmit event. I want to prevent the page from reloading when onSubmit is executed.
In a standard form's onSubmit, executing event.preventDefault() can prevent the page from reloading. I would like to achieve the same behavior.
The current code is as follows:
Originally, I was using Form actions, but I wanted to enable prerender, so I switched to using API Routes instead.