PlainError

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

Last checked 2026-11-11 · 3 fixes · reviewed answer

TL;DRThis React error occurs when your app's code triggers repeated screen updates in a loop, so React stops it to avoid freezing the browser.

Most likely cause: State update placed directly inside the component function or JSX, causing it to run on every render

Try first: Locate the component mentioned in the stack trace

Likely causes

  1. State update placed directly inside the component function or JSX, causing it to run on every rendermost likely
  2. useEffect hook missing a dependency or updating state that it depends onpossible
  3. Event handler incorrectly calling a state setter during render instead of on user actionless likely

How to fix it

Safest first: SafeChanges settingsDangerous
  1. Locate the component mentioned in the stack traceSafe

    Open the file and look for any setState or useState updater calls that are not inside an event handler or useEffect.

  2. Move any direct state updates into a useEffect or an event handlerChanges settings

    Wrap the state change so it only runs after render or when triggered by the user.

  3. Add or correct the dependency array in useEffect hooks that update stateChanges settings

    Include all values the effect reads so it does not rerun endlessly.

    ⚠ Test the component after changes to ensure behavior is correct.

If that didn't fix it

Add console.log statements before each state update to see which one is firing repeatedly.

When to see a technician

If you are not comfortable editing React code, share the component file with a developer.

Quick answers

What does Error: Too many re-renders. React limits the number of renders to prevent an infinite loop mean?
This React error occurs when your app's code triggers repeated screen updates in a loop, so React stops it to avoid freezing the browser.
What causes Error: Too many re-renders. React limits the number of renders to prevent an infinite loop?
State update placed directly inside the component function or JSX, causing it to run on every render. (most likely) useEffect hook missing a dependency or updating state that it depends on. (possible) Event handler incorrectly calling a state setter during render instead of on user action. (less likely)
How do I fix Error: Too many re-renders. React limits the number of renders to prevent an infinite loop?
Try these in order, safest first: 1. Locate the component mentioned in the stack trace. 2. Move any direct state updates into a useEffect or an event handler. 3. Add or correct the dependency array in useEffect hooks that update state.
What if that didn't fix it?
Add console.log statements before each state update to see which one is firing repeatedly.
When should I see a technician?
If you are not comfortable editing React code, share the component file with a developer.
Did this fix it? Report a problem

Related errors

All Coding errors →