Search
 
SCRIPT & CODE EXAMPLE
 

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>
Comment

PREVIOUS NEXT
Code Example
Javascript :: ejs comments 
Javascript :: update node .js 
Javascript :: document get element by tag 
Javascript :: document on click dynamic element 
Javascript :: angular ng serve with custom port 
Javascript :: count all elements with class jquery 
Javascript :: js response to json log 
Javascript :: jquery onchange 
Javascript :: js regex email 
Javascript :: moment format date dd/mm/yyyy 
Javascript :: js get first space in string 
Javascript :: how to remove underline from material ui select 
Javascript :: jquery datatable returning current datetime 
Javascript :: bar chart height and with change in chart.js 
Javascript :: add select option javascript 
Javascript :: javascript foreach get key and value 
Javascript :: country code regex 
Javascript :: console log all events 
Javascript :: regex do not contain 
Javascript :: python json dump to file 
Javascript :: separate digits in javascript 
Javascript :: clz32 
Javascript :: javascript get age 
Javascript :: find min value in array javascript 
Javascript :: javascript get utc time 
Javascript :: install react with old version of node 
Javascript :: javascript add day to date 
Javascript :: express check if object is empty 
Javascript :: window.location.href target blank 
Javascript :: how to disable right click in javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =