title: React component class, can't write async method?
body: <p>I'm hazy on async, and I'm not sure why I'm getting a syntax error in my react component while trying to write a simple async method. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class Locations extends React.Component {
    constructor(props) {
      super(props);
  
      this.searchProducts = this.searchProducts.bind(this);
  
    }
  
      async searchProducts(product_name, storeId) {
      let response =  await axios.get(
        `https://api.goodzer.com/products/v0.1/search_in_store/?storeId=${storeId}&amp;query=${product_name}&amp;apiKey=125cbddf3880cb1ba652a7c269ba1eb0`
      );
      console.log(response);
      return response.data.products;
  
  }
  
    componentWillMount() {
      let products = [];
      this.props.searchLocations(this.props.navigation.state.params.product_name, this.props.navigation.state.params.searchRadius)
        .then(
            products = (this.props.locations.map(
            location =&gt; ({[location.id]: this.searchProducts(
              this.props.navigation.state.params.product_name, location.storeid
            )}))
          )
        );
  
        console.log(products);
    }
  
    render() {
      const displayLocations = this.props.locations.map(
        location =&gt; (&lt;Text key={location.id}&gt;{location.name}&lt;/Text&gt;)
      );
      return (
        &lt;View&gt;
          &lt;Text&gt;HELLO&lt;/Text&gt;
          &lt;View&gt;{displayLocations}&lt;/View&gt;
        &lt;/View&gt;
      );
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'm getting a syntax error: 'Unexpected token, expected ('.</p>
  
  <p>I don't understand how this is any different than the examples given here: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/async_function" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/async_function</a></p>