title: ERROR: Maximum update depth exceeded. This can happen when a component repeatedly calls
body: <p>I'm new to react and I've been playing around with it the past few days. Whenever I try to run this simple code below it keeps giving me the error. </p>
  
  <p><strong>"Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops."</strong></p>
  
  <p>I'm not sure why, can anybody please help me? Thank you in advance.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, { Component } from 'react';
  import { render } from 'react-dom';
  
  
  
  export default class State1 extends React.Component {
  
    constructor() {
      this.state = { value: "llll" };
    }
  
    change() {
      setTimeout(()=&gt;{
        this.setState({value:"eeee"});
      },3000);
    }
  
    change2() {
        this.setState({value:"eeee"});
    }
    
    render() {
      {this.change2()};
      return (
        &lt;div &gt; {this.state.value} &lt;/div &gt;
      ) 
    }
  
  
  }</code></pre>
  </div>
  </div>
  </p>