title: Why React SetState is not working as expected?
body: <p>I have this code, in my React component:
  (__loadItems() returns a Promise.)</p>
  
  <pre><code>componentDidMount(){
      const self=this;
      this.__loadItems().then((itemsCollection) =&gt; {
          // below will log what I expect:
          console.log('itemsCollection', itemsCollection);
  
          self.setState( (state, props) =&gt; {
  
  
               return {
                   itemTypes: itemsCollection,
               };
          }, () =&gt; {
          //below will contain what expected
          console.log(self.state.itemTypes);
          //ISSUE: state.itemTypes will be Array(0)
          console.log(self.state);
  
          // });
      });
  }
  </code></pre>
  
  <p>Why my state itemTypes won't be set as expected?</p>
  
  <pre><code> console.log(self.state)
  </code></pre>
  
  <p>will output:</p>
  
  <pre><code> { itemTypes: Array(0)}
  </code></pre>