title: "this" undefined inside of a Promise.all().then()
body: <p>I'm trying to perform <code>this.setState(…)</code> inside a <code>Promise.all(…).then(…)</code> - i.e. a function after resolving a Promise, 
  but it seems that <code>this</code> is <code>undefined</code> inside of <code>then(…)</code>.</p>
  
  <p>After doing some reading, I found that (<code>this</code>) needs to be bound inside of <code>then(…)</code>.
  But, I'm not clear on how to bind it.</p>
  
  <p>below is my original code. </p>
  
  <pre><code>var productSource = await this.state.productAll.filter(
    product =&gt; product.exchangeId === exchange.exchangeId
  );
  var productOptions = await this.state.productAll.filter(
    product =&gt; product.exchangeId !== exchange.exchangeId
  );
  
  Promise.all([productSource, productOptions])
    .then((promises) =&gt; {
    this.setState({
      currentExchange: exchange,
      currentCurrency: exchange.baseCurrency,
      originExchange: exchange,
      productSource: promises[0],
      productOptions: promises[1]
    });
    this.refresh();
  });
  </code></pre>
  
  <p>Is below correct way of doing this?</p>
  
  <pre><code>var productSource = await this.state.productAll.filter(
    product =&gt; product.exchangeId === exchange.exchangeId
  );
  var productOptions = await this.state.productAll.filter(
    product =&gt; product.exchangeId !== exchange.exchangeId
  );
  
  Promise.all([productSource, productOptions])
    .then((promises) =&gt; {
      this.setState({
      currentExchange: exchange,
      currentCurrency: exchange.baseCurrency,
      originExchange: exchange,
      productSource: promises[0],
      productOptions: promises[1]
    });
    this.refresh();
  }).bind(this);
  </code></pre>
  
  <p>Thanks! </p>