Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

clear input field react-hook-form

const InputForm = () => {
  const { register, handleSubmit, reset } = useForm();

  const onSubmit = (data) => {
    //...
    reset();
  };
Comment

react hook form clear form

// ❌ avoid the following with deep nested default values
const defaultValues = { object: { deepNest: { file: new File() } } };
useForm({ defaultValues });
reset(defaultValues); // share the same reference

// ✅ it's safer with the following, as we only doing shallow clone with defaultValues
useForm({ deepNest: { file: new File() } });
reset({ deepNest: { file: new File() } });
Comment

PREVIOUS NEXT
Code Example
Javascript :: transitionduration 
Javascript :: javascript transition 
Javascript :: split text and join in js 
Javascript :: object values javascript 
Javascript :: javascript template string examples 
Javascript :: get parent id javascript 
Javascript :: jquery get all checkbox checked 
Javascript :: search no of item in array 
Javascript :: livewire upload progress 
Javascript :: json merge 
Javascript :: comparsion javascript 
Javascript :: Finding HTML Element by Id 
Javascript :: neo4j create relationship between existing nodes 
Javascript :: javascript replace all 
Javascript :: javascript tofixed 
Javascript :: js is numeric 
Javascript :: fetch data flutter json 
Javascript :: js shortcut 
Javascript :: javascript replace text within dom 
Javascript :: why do you have to set key prop in react 
Javascript :: js append en tête 
Javascript :: change page title js 
Javascript :: how to update kali linux on virtualbox 
Javascript :: TypeError: (0 , T.useState) is not a function 
Javascript :: Convert number to array of digits js 
Javascript :: js round 2 digits 
Javascript :: statusbar reactnati 
Javascript :: add image in react native 
Javascript :: ecmascript compose 
Javascript :: hello word in js 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =