The useRef hook lets you keep a mutable value that persists across renders without causing a re-render when it changes. It’s most commonly used to access DOM elements or to store values between renders.

Basic syntax

const ref = useRef(initialValue);

focus input field

Screenshot 2026-01-13 at 5.49.29 AM.png

additional resources