title: How to use async await with React componentDidMount() method?
body: <p>I want to use <code>async/wait</code> with React <code>componentDidMount()</code> method but I am getting  <strong>await is a reserved word</strong> error. I also tried wrap the statement in Immediate Invoked Function but it didn't help.</p>
  
  <pre><code>async componentDidMount() {
    this.geoLocation.getAddress().then(location =&gt; {
      if (location.address != null &amp;&amp; location.error != "undefined") {
        let fifteenMins = [];
        await this.getFifteenMinsData(y, x).then(
          data =&gt; {
            fifteenMins = data["forecasts"];
          }
        );
          console.log(fifteenMins);
      } 
    });
  }
  </code></pre>
  
  <p>If I remove the <code>await</code> keyword, then I get <code>null</code> in console.log, but if I do console log right before <code>fifteenMins = data["forecasts"];</code> then I get data. </p>
  
  <p>Related question:
  <a href="https://stackoverflow.com/questions/42299594/await-is-a-reserved-word-error-inside-async-function">Await is a reserved word error inside async function</a></p>