useRef:

keypoints :

useRef returns an object with a special property called current.

Updating the reference value doesn't cause a re-render of the component.

useEffect side effect cannot be controlled using useRef variables.useEffect callback can only be controlled using state or props.

example :

function App{
	const inputRef=useRef()
	
	useEffect(()=>{
	inputRef.current.focus();
	})
	
	return(
		<div>
			<input type="text"  onChange={e=>setState(e.target.value)}  ref={inputRef}/>
		</div>
) }

Use case: