Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.
A component keeps updating itself in an effect or lifecycle — usually a useEffect that sets state its own dependencies change.
Seen on:
React
Meaning
Effects without proper dependencies, or dependencies that are new objects each render, trigger setState → render → effect → setState endlessly.
Common causes
- useEffect setting state with no dependency array
- Object/array dependency recreated every render
- componentDidUpdate calling setState unconditionally
⚡ Quick fix
- Add correct dependencies
- Memoize objects with useMemo/useCallback
- Compare before setting state
Detailed fix by platform
React
useEffect(() => { if (value !== prev) setPrev(value); }, [value, prev]);
How to diagnose
- Effect — Which effect sets state?
- Deps — Stable dependencies?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026