title: react select async option,
body: <p>I am trying to use <a href="https://github.com/JedWatson/react-select#async-options" rel="nofollow">this component</a> with the async options using es5. I have a service call in my componentDidmount which sets the schools array using a callback:</p>
  
  <pre><code>componentDidMount: function(){
  
      SchoolsDataService.getSchools(
          this.setSchoolsState
      );
  </code></pre>
  
  <p>Which sets the schools list to the state array</p>
  
  <pre><code>setSchoolsState: function(data){
  
      this.setState({schools: data.schools})
  
  },
  </code></pre>
  
  <p>Service:</p>
  
  <pre><code>getSchools: function (callback) {
  
      var url = 'xxxx';
  
      request
          .get(url)
          .set('Accept', 'application/json')
          .end(function (err, res) {
              if (res.ok) {
                  var data = res.body;
                  if (data) {
                      callback(data);
                  }
              }
          });
  }
  </code></pre>
  
  <p>How can I set this up using the example in the docs? Where would I put the service call for the async version like this and generate the options list?</p>
  
  <pre><code>var getOptions = function(input, callback) {
  setTimeout(function() {
      callback(null, {
          options: [
              { value: 'one', label: 'One' },
              { value: 'two', label: 'Two' }
          ],
          // CAREFUL! Only set this to true when there are no more options,
          // or more specific queries will not be sent to the server.
          complete: true
      });
  }, 500);
  };
  </code></pre>
  
  <p>MY component is rendered using:</p>
  
  <pre><code>  &lt;Select.Async
           name="form-field-name"
           value="one"
           loadOptions={getOptions}/&gt;
  </code></pre>
  
  <p>I get this error:</p>
  
  <p>Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of <code>TableModalComponent</code>.</p>
  
  <p>I have it at the top of my page:</p>
  
  <pre><code>Select = require('react-select'),
  </code></pre>