TLDR Tech / Dev
3 ways to store variables in React, and why you shouldn't sleep on useRef
There are three ways to store variables in React, with a particular focus on the `useRef` hook. Vanilla JavaScript variables are temporary and do not cause UI updates, while `useState` variables persist, update the UI, and are essential for reactive components.`useRef` allows data to persist and be mutable across renders without triggering a re-render of the UI.
Read the full story