title: How can getDerivedStateFromProps method can access state if the state is initialized from within the constructor(props)?
body: <p>Hi all I am new to <code>ES6</code> and <code>React</code> and I am stuck in component lifecycle-creation of react. My question is In my constructor I have initialized state..</p>
  <pre class="lang-js prettyprint-override"><code>constructor(props) {
      super(props);
      this.state = {
      ....something
  }
  </code></pre>
  <p>Now in the Component Lifecycle Creation in react we have <code>getDerivedStateFromProps</code>  which is a static function which takes two arguments props and previous state and you might return the current state or so depending if you are changing the state from props or not</p>
  <pre class="lang-js prettyprint-override"><code>static getDerivedStateFromProps (props, state) {
      ... do something
      return state;
  }
  </code></pre>
  <p>How is this static function able to access or have a property which is initialized in <code>constructor()</code> which will run at runtime or when the object is created ? Isn't the static function runs before runtime at class loading time so how is it able to access state object ?</p>