title: Assign to `this.state` directly or define a `state = {};` class property with the desired state in the Dashboard component
body: <p>I'm passing a string value from one component class to another and try to update the state in another class</p>
  
  <pre><code>class Dashboard extends Component {
  
   constructor(props) {
    super(props);
    this.state = {
      systemDetailsData: null,
     }
   }
     CalledFromHeader = (systemDetailsData11) =&gt; {
       this.setState({ systemDetailsData:systemDetailsData11 })
     }
   }
  
  
  
    class Header extends Component {
  
      constructor(props) {
      super(props);
      Dashboard_Obj = new Dashboard();
       }
  
      OnPress = () =&gt; {
      Dashboard_Obj.CalledFromHeader("system data");
      }
     }
  </code></pre>
  
  <p>I'm getting this error ---> Warning: Can't call setState on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to <code>this.state</code> directly or define a <code>state = {};</code> class property with the desired state in the Dashboard component.</p>
  
  <p>I want to update the state in Dashboard class using above code, Can anyone help me how to achieve this?</p>