Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

preventdefault not working react

//think if you are adding your submit handler function in the submit button
//or into the form itself
const handler = () => {
  e.preventDefault();
}
<form onSubmit={handler}> //good
<button type="submit" onSubmit={handler}> // bad  
 
PREVIOUS NEXT
Tagged: #preventdefault #working #react
ADD COMMENT
Topic
Name
5+6 =