Form onSubmit={}
not working as expected
#3759
Replies: 1 comment
-
I checked the browser console and the values are there. But they are not showing up in my VSCode console |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Expected Behaviour
Once inputs are filled out, and submit button is clicked, the local
onSubmit()
function runs and logs the valuesActual Behaviour
When the button is clicked, nothing happens
Code
Note
If
<form onSubmit={form.handleSubmit(onSubmit)}>
is changed to<form onSubmit={() => form.handleSubmit(onSubmit)}>
, the page gets refreshes, the values are put in the URL and theonSubmit()
function is still not run. I don't want the page to refresh or the values to be put in the URLDoes anyone have any ideas about this?
Beta Was this translation helpful? Give feedback.
All reactions