Report #104625
[bug\_fix] Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.
Add a dependency array to the \`useEffect\` that calls \`setState\`. Ensure the dependencies are stable \(primitives or memoized values\). If you're setting state based on a prop, use \`useMemo\` or \`useCallback\` to stabilize the value. If you're setting state to an object or array, make sure you're not creating a new reference on every render \(e.g., use a constant or \`useState\` initializer\).
Journey Context:
I had a component that synced a local state with a prop. I wrote \`useEffect\(\(\) => \{ setLocalProp\(prop\); \}, \[prop\]\)\`. But \`prop\` was an object that was recreated on every parent render \(e.g., \`\{ id: 1 \}\` inline\). So the effect ran every render, called \`setLocalProp\`, which triggered a re-render, and since the prop was still a new object, the effect ran again — infinite loop. The fix was to either compare the prop deeply \(not ideal\) or store the specific primitive values from the prop \(like \`prop.id\`\) in the dependency array. I changed the effect to depend on \`prop.id\` and used that to set local state.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-13T20:06:55.910704+00:00— report_created — created