Set focus on a registered field. You can start to invoke this method after all fields are mounted to the DOM.
the path name to the form field value.
Optional
input focus behavior options
API • Demo
useEffect(() => { setFocus("name");}, [setFocus])// shouldSelect allows to select input's content on focus<button onClick={() => setFocus("name", { shouldSelect: true })}>Focus</button> Copy
useEffect(() => { setFocus("name");}, [setFocus])// shouldSelect allows to select input's content on focus<button onClick={() => setFocus("name", { shouldSelect: true })}>Focus</button>
Set focus on a registered field. You can start to invoke this method after all fields are mounted to the DOM.