react autofocus input class component code example
Example: autofocus react
const emailInputRef = React.useRef(null);
React.useEffect(()=>{
emailInputRef.current.focus();
}, []);
<input type="email" name="email" ref={this.emailInputRef} />
const emailInputRef = React.useRef(null);
React.useEffect(()=>{
emailInputRef.current.focus();
}, []);
<input type="email" name="email" ref={this.emailInputRef} />