I am a beginner React developer. I am trying to enhance a forms tutorial I did using hooks. I refactored the code so that the inputs and button are each a separate component. I have also refactored the hooks so that each hook is in a separate file. The problem that I am running into is the handleSubmit method in the useSubmitted custom hook (hooks/useSubmitted.js) file. I keep getting the error TypeError: event.preventDefault is not a function. I have tried to fix it and also looked for a solution in Google, but to no avail.
Any help would be appreciated it.
Thanks
handleSubmitfunction that takes (presumably) a form's submit event object, but then pass it a boolean value immediately in your app code,handleSubmit(submitted). Boolean values won't have apreventDefaultproperty on them.