Answers for "clear form in react"

0

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>
Posted by: Guest on October-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language