<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Cannot update a component while rendering a different component]]></title><description><![CDATA[<pre><code class="language-jsx">Cannot update a component while rendering a different component
</code></pre>
<p dir="auto"><strong>Причина</strong>: Вызов setState во время рендеринга другого компонента.</p>
<p dir="auto"><strong>Пример</strong>:</p>
<pre><code class="language-jsx">function Parent() {
  const [state, setState] = useState();
  return &lt;Child setState={setState} /&gt;;
}

function Child({ setState }) {
  setState(42); // Вызов здесь запрещен!
  return &lt;div&gt;...&lt;/div&gt;;
}
</code></pre>
<p dir="auto"><strong>Решение</strong>: Использовать useEffect для сайд-эффектов.</p>
]]></description><link>https://forum.exlends.ru/topic/82/cannot-update-a-component-while-rendering-a-different-component</link><generator>RSS for Node</generator><lastBuildDate>Wed, 20 May 2026 08:56:34 GMT</lastBuildDate><atom:link href="https://forum.exlends.ru/topic/82.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 03 Feb 2025 08:02:46 GMT</pubDate><ttl>60</ttl></channel></rss>