Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

clear form in react

//with the useref hook you can do it easily
const form = useRef(null);

const handlesubmit = () => {
  form.current.reset(); //this will reset all the inputs in the form
}
<form ref={form} onSubmit={handlesubmit}></form>
 
PREVIOUS NEXT
Tagged: #clear #form #react
ADD COMMENT
Topic
Name
7+7 =