# React Hooks Reference

The built-in hooks and when to use them.

| Hook | Use |
|---|---|
| `useState` | Local state: `const [v, setV] = useState(0)` |
| `useEffect` | Side effects after render; dependency array controls reruns |
| `useRef` | Mutable value or DOM node that does not trigger renders |
| `useMemo` | Cache an expensive computed value |
| `useCallback` | Cache a function identity |
| `useContext` | Read a context value |
| `useReducer` | State with complex transitions |
| `useLayoutEffect` | Effect before the browser paints |
| `useId` | Stable unique ids |
| `useTransition` | Mark updates as non-urgent |

**Rules:** call hooks only at the top level of components or custom hooks (names start with `use`), never in loops or conditions.

```jsx
useEffect(() => {
  const id = setInterval(tick, 1000);
  return () => clearInterval(id);   // cleanup
}, []);                             // [] = run once on mount
```
