← React Intermediate Questions - Set 2 Q11

What is the `useRef` hook in React and how is it used?

React Intermediate Questions - Set 2

Example

const inputRef = useRef(null);
inputRef.current.focus();       // DOM access
const timerRef = useRef(0);     // mutable value, no re-render

What to notice

← Back to the question list