title: Return values from promise(then)
body: <p>i'm having difficulties in returning some values from a promise.  </p>
  
  <p>This is my code:</p>
  
  <pre><code>getInitialState: function() {
   var me = this;
   var promise = me.getChosenProtocols();
  
   return (promise.then(function(value) {
     var ChosenProtocols = Object.keys(value).map(key =&gt; value[key]);
     return ({
       showModal: (ChosenProtocols.length == 0) ? true : false,
       SelectedProtocols: ChosenProtocols,
       nmTitle: SE.t(218997)
     });
     }, function (value) {
       return({
       showModal: true,
       SelectedProtocols: [],
       nmTitle: SE.t(218997)
     });
   }));
  },
  </code></pre>
  
  <p>So what is happening, getChosenProtocols returns a resolved promise, and i am trying to return values from it.<br>
  Any help would be appreciated.   </p>
  
  <p>Thanks everyone, it worked when i changed it to be like this: </p>
  
  <pre><code>getInitialState: function() {
      var me = this;
  
      return ({
              showModal: false,
              SelectedProtocols: [],
              nmTitle: SE.t(218997)
      });
  },
  
  componentWillMount: function() {
      var me = this; 
      var promise = me.getChosenProtocols();
  
      promise.then(function(value) {
          var selectedProtocols = Object.keys(value).map(key =&gt; value[key]);
  
          me.setState({
              showModal: (selectedProtocols.length == 0 ) ? true : false,
              SelectedProtocols: selectedProtocols
          })
      });
  },
  </code></pre>