React 19 · State and effects

Keep a mutable value or DOM node

A ref persists between renders without causing a re-render.

const inputRef = useRef<HTMLInputElement>(null);
inputRef.current?.focus();

Official React 19 documentation

More state and effects commands

All state and effects commands · React 19 cheatsheet

Was this page helpful?