1
ReactAdvanced#hooks#performance
useRef holds a mutable value in a box that survives re-renders without causing them. It is used for DOM access, storing timers or previous values, and holding non-render data.
const inputRef = useRef(null);
useEffect(() => inputRef.current?.focus(), []);
return <input ref={inputRef} />;