Glossary term
What is useRef? Meaning for developers
In Senior Frontend Depth
A box you can change that survives renders and does not cause a render. Use it for DOM nodes, timer IDs and 'latest value' holders.
Learn it properly · Senior Frontend DepthLesson 1: Hooks in Depth: Effects, Refs and the RulesEffect dependencies, stale closures, useRef vs state, useLayoutEffect and the idea behind “You Might Not Need an Effect”.In React in Depth
A stable { current } box that survives renders; changing it does not cause a re-render, and it can hold a DOM node.
Learn it properly · React in DepthLesson 3: Hooks in Depth: useRef, useMemo, useCallback, useReducer and Custom HooksEach hook with one small reason to use it, the rules of hooks and why they exist, and how to write a custom hook.