title: react js state variable updates automatically without setstate method
body: <p>I am working on a react js project. I have a state variable and I initialize that state variable (<code>x_state</code>) with another normal variable (<code>x</code>) during the <code>componentDidMount()</code> method. 
  But whenever my normal variable (<code>x</code>) gets updated it is automatically updating the state variable (<code>x_state</code>). </p>
  
  <pre><code>export class Demo extends React.Component {
    constructor(props) {
      super(props);
      this.state = {
        x_state: null
      }
      this.x = {}
    }
  
    componentDidMount() {
      this.setState({
        x_state: this.x
      })
    }
  }
  </code></pre>
  
  <p>The local variable this.x is updating on specific conditions inside the code. whenever the local variable this.x is updating it is automatically updating the state variable x_state. 
  How to prevent the automatic update or automatic setstate method invoking</p>