title: React Warning: Cannot update a component from inside the function body of a different component
body: <p>I am using Redux with Class Components in React. Having the below two states in Redux store.</p>
  
  <pre><code>{ spinner: false, refresh: false }
  </code></pre>
  
  <p>In Parent Components, I have a dispatch function to change this states.</p>
  
  <pre><code>class App extends React.Component {
    reloadHandler = () =&gt; {
      console.log("[App] reloadComponent");
  
      this.props.onShowSpinner();
      this.props.onRefresh();
    };
  
    render() {
      return &lt;Child reloadApp={this.reloadHandler} /&gt;;
    }
  }
  </code></pre>
  
  <p>In Child Component, I am trying to reload the parent component like below.</p>
  
  <pre><code>class Child extends React.Component {
    static getDerivedStateFromProps(props, state) {
      if (somecondition) {
        // doing some redux store update
        props.reloadApp();
      }
    }
  
    render() {
      return &lt;button /&gt;;
    }
  }
  </code></pre>
  
  <p>I am getting error as below.</p>
  
  <blockquote>
    <p>Warning: Cannot update a component from inside the function body of a
    different component.</p>
  </blockquote>
  
  <p>How to remove this warning? What I am doing wrong here?</p>