Use useRef when you need to reference a DOM element, such as for focusing an input field, measuring its dimensions, or accessing its properties without causing re-renders.