Too many re-renders React Origin: On your device OSI layer 7 · Application Last updated 14 Oct 2026

Error: Too many re-renders. React limits the number of renders to prevent an infinite loop.

A state update runs during render, which triggers another render, which updates state again — forever.

Exact message you may see Too many re-rendersReact limits the number of renders to prevent an infinite loopMaximum update depth exceeded
Seen on: React

Meaning

Calling setState unconditionally in the component body — or passing onClick={setCount(1)} instead of a function — makes every render schedule another one.

Common causes

  • onClick={handle()} instead of onClick={handle} or onClick={() => handle()}
  • setState called directly in the component body
  • useEffect without a dependency array that sets state
  • useEffect dependency that changes every render (new object/array literal)

⚡ Quick fix

  1. Pass functions to event props, don’t call them
  2. Move state updates into event handlers or effects with correct dependencies
  3. Memoize object/array dependencies with useMemo

Detailed fix by platform

React

  1. Common fix:
    jsx
    <button onClick={setOpen(true)}>Open</button>          // ❌ runs during render
    <button onClick={() => setOpen(true)}>Open</button>    // ✅

How to diagnose

  1. Event props — Any onX={fn()}?
  2. Render body — Any unconditional setState?
  3. Effects — Dependency arrays correct?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Actions must be plain objects — Error: Actions must be plain objects. Instead, the actual type was: 'function'. (React)Actions must be plain…Element type is invalid — Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined (React)Element type is inval…Error acquiring the state lock — Terraform: Error: Error acquiring the state lock — ConditionalCheckFailedException / state blob is already locked (Terraform)Error acquiring the s…Functions not valid as child — Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. (React)Functions not valid a…Invalid hook call — Error: Invalid hook call. Hooks can only be called inside of the body of a function component. (React)Invalid hook callMaximum update depth — Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. (React)Maximum update depthmeasured with an infinity maximum height — Jetpack Compose: Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed (Android)measured with an infi…Modifying state during view update — SwiftUI: Modifying state during view update, this will cause undefined behavior (iOS)Modifying state durin…Too many …

Explore the map of this error Full error map →

🧠 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.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.