DEV Community

Harish raj
Harish raj

Posted on

use ref() in react

const next=()=>{
set currentquestion(currentquestion+1);
}

function next(){
set currentquestion (currentquestion+1)

useing useref();

const userref=useref();

useffect (()=>{
useref.current.focus();


<input ref={user Ref}

start with inputbox dont drag the mouse inside the box.

direct dom access.

use ref();
it will store the data.
mutable store the value .changing data can store the access the dom

Top comments (0)