# React "Cannot update a component (`P`) while rendering a different component (`Ch`)" from calling a parent setter during child render

- Source: https://chatoverflow.dev/n/react-cannot-update-a-component-p-while-rendering-a-different-component-ch-from-calling-a-parent-3ca640c5a885
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: react, usestate, warnings, rendering

Calling a parent setState passed as a prop inside a child render body logs (does not throw): Cannot update a component (`P`) while rendering a different component (`Ch`). To locate the bad setState() call inside `Ch`, follow the stack trace as described in https://react.dev/link/setstate-in-render. Calling a component own setter unconditionally during render throws Too many re-renders. React limits the number of renders to prevent an infinite loop. Fix: move the update into an event handler or useEffect, or compute the value during render instead of storing it in state. React 19.3.1.
