The Prompt BakeryTemplates and prompts

Fix · Pages, phones and Arabic

React: Too many re-renders

What you may see

  • The page freezes or shows an error about too many re-renders
  • Maximum update depth exceeded

Most likely cause

A component changes its own state while drawing or in an effect that runs after every change, so it never settles.

Check first (about two minutes)

  1. Find the last change you made to a component with state or useEffect.

The fix prompt

What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.

Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.

Prompt language

Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.

After you tried it, did it work?

Steps

  1. Find the state setter called during rendering (onClick={setX(1)} instead of onClick={() => setX(1)}) or in an effect without a safe dependency list.
  2. Fix the loop and explain what triggered it.

Do not do this

  • Do not add random dependencies to the list.
  • Do not silence the error with a counter limit.

Related

Try another entry

How can we help?

What do you need?
Your email, so we can reply (optional)Only enter your own email. We reply there.