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 :: npm ERR! code EACCES 
Javascript :: javascript keypress backspace not working 
Javascript :: generate random date in javascript 
Javascript :: how to replace all characters in a string javascript 
Javascript :: how to assign port in angular 
Javascript :: javascript seconds to min and seconds 
Javascript :: google sheets get sheet by name 
Javascript :: jquery onchange input value 
Javascript :: check email js 
Javascript :: javascript do arrays intersect 
Javascript :: This version of CLI is only compatible with Angular versions ^9.0.0-beta || =9.0.0 <10.0.0, but Angular version 8.1.3 was found instead. 
Javascript :: how to reset form after submit using jquery and ajax 
Javascript :: sockjs.min.js cdn 
Javascript :: step over vs step into vs step out 
Javascript :: for of get index 
Javascript :: javascript foreach key value 
Javascript :: react chartjs size 
Javascript :: change favicon with javascript 
Javascript :: horizontal divider react native 
Javascript :: jquery set text of h1 
Javascript :: jquery disable enter key submit 
Javascript :: import reactdom 
Javascript :: jquery scroll to top of div 
Javascript :: how to add two number using jqueryu 
Javascript :: remove object from array of objects based on object property javascript 
Javascript :: express js get origin 
Javascript :: create button inside td tag javascript 
Javascript :: remove first 3 characters from string javascript 
Javascript :: nodejs server fetch is not defined 
Javascript :: retour a la ligne <p react 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =