useEffect

useEffect is the React hook that runs a side effect after rendering: a network call, a subscription, a timer, DOM access. Its dependency array controls when it re-runs: on every render if absent, once if empty, and whenever a listed value changes otherwise.

Example

useEffect(() => {
  document.title = `Panier (${n})`;
}, [n]);

Related concepts

The whole glossary