WeCodeAcademy

useRef

useRef holds a value that survives renders without causing a re-render. It is often used to reach a DOM element directly, for example to focus an input.

Examplereact
Open in editor »
Quick check

What is the main difference between `useRef` and `useState`?

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.