<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: jo-Rdan250</title>
    <description>The latest articles on DEV Community by jo-Rdan250 (@jo_rdan).</description>
    <link>https://dev.to/jo_rdan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F884188%2Ffac4d500-fe3a-454e-84b6-886cbd8e9453.png</url>
      <title>DEV Community: jo-Rdan250</title>
      <link>https://dev.to/jo_rdan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jo_rdan"/>
    <language>en</language>
    <item>
      <title>How to fix React "Maximum update depth exceeded" error and why it happens</title>
      <dc:creator>jo-Rdan250</dc:creator>
      <pubDate>Tue, 21 Jul 2026 13:35:03 +0000</pubDate>
      <link>https://dev.to/jo_rdan/how-to-fix-react-maximum-update-depth-exceeded-error-and-why-it-happens-49kk</link>
      <guid>https://dev.to/jo_rdan/how-to-fix-react-maximum-update-depth-exceeded-error-and-why-it-happens-49kk</guid>
      <description>&lt;p&gt;The first time I started working with React, I completely fell in love with it(not literally but...). However, just like in any other relationship, there will be problems and tribulations. I know what you're thinking, "this guy talking about libraries like it's a girl! Seriously?". Yeah, I know, but that's the only analogy I could find. Am sorry, hihihihii!&lt;/p&gt;

&lt;p&gt;So, where was I? Right, problems and tribulations. and just like any other relationships, you get to correct mistakes you made but you have to understand why those kind of mistakes happen first(so that you won't have to make the same mistakes again, Obviously.).&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Javascript&lt;/li&gt;
&lt;li&gt;A very tiny bit of notion on React&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Today, we will be talking about the following error and why it occur in our code. I won't be using a lot of technical terms in this blog, I just want you guys to understand the idea behind.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fudrav37lagak65g1av2j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fudrav37lagak65g1av2j.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To understand why this error occur, you have to understand how &lt;strong&gt;React&lt;/strong&gt; works. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;React&lt;/em&gt;&lt;/strong&gt; is a JavaScript library for building user interfaces.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Yes, React is a library for building user interfaces using what we call &lt;code&gt;components&lt;/code&gt;. Components(as of now, with React hooks) are just functions that contain a variable called &lt;code&gt;state&lt;/code&gt;. Here is an example of a simple Component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MessageComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Welcome&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;my&lt;/span&gt; &lt;span class="nx"&gt;first&lt;/span&gt; &lt;span class="nx"&gt;blog&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see in the codeblock above, &lt;code&gt;MessageComponent&lt;/code&gt; is the name of our component and it's a function. this function accepts a parameter called &lt;code&gt;props&lt;/code&gt; and returns a JSX(a syntax extension to JavaScript). &lt;/p&gt;

&lt;h2&gt;
  
  
  The State
&lt;/h2&gt;

&lt;p&gt;The state plays a very crucial role in React. Like the name suggests, it represents the state of the DOM. Basically, it helps React know what to update in the UI, where and when. Consider the following block of code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MessageComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Welcome&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;const [message, setMessage] = useState('Welcome');&lt;/code&gt; this is how we create a state variable in React hooks. The function &lt;code&gt;useState&lt;/code&gt; returns an array containing a variable(the state) and a function to update the state.&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
