title: state not updating after AJAX call using setState()
body: <p>I am not getting state updated after making a AJAX call in componentDidMount.  My  api call is returning the correct data .  </p>
  
  <p>Any ideas if I am doing setState in wrong lifecycle component? Making the AJAX request in the componentDidMount and also setting the new state there.  In the constructor I set the state to empty arrays</p>
  
  <pre><code>class DeliveryDateInput extends React.Component {
  constructor(props) {
      super(props);
      this.getDeliveryDate = this.getDeliveryDate.bind(this);
  
      this.state = {
          selectDate: selectedDate || validDelDateArray[0],
          validDeliveryDateArray: validDelDateArray,
          firstDeliveryDay: [],
          lastDeliveryDay: [],
          selectedDate: [],
          deliveryDatesAllowed: [],
          offDays: [],
      };
  }
  
  componentDidMount () {
      console.log('App componentDidMount');
      this.getDeliveryDate();
  }
  
  componentWillUpdate(nextProps, nextState) {
      this.getDeliveryDate();
      console.log('Your prev offday state: ' + this.state.offday);
      console.log('Your next offday state: ' + nextState.offday);
  }
  
  getDeliveryDate() {
      const self = this;
      $.ajax({
          type: 'GET',
          url:  //deliveryDateAPI,
          contentType: 'application/json; charset=utf-8',
          success(data) {
              self.setState({
                  firstDeliveryDay: data.firstDeliveryDate,
                  lastDeliveryDay: data.lastDeliveryDay,
                  selectedDate: data.firstDeliveryDate,
                  deliveryDatesAllowed: data.deliveryDates,
                  offDays: data.offDays,
              });
          },
          failure(errMsg) {
              console.log(errMsg);
          },
      });
  }
  </code></pre>