title: How to fix Parsing error: Can not use keyword 'await' outside an async function
body: <p>Getting a error message saying <code>Parsing error: Can not use keyword 'await' outside an async function</code> from below code for Redux action.</p>
  
  <p>What is the proper way to write this?</p>
  
  <pre><code>export async function getData() {
    return (dispatch) =&gt; {
      try {
        const data = await API.graphql(graphqlOperation(query))
        dispatch({ type: "DATA_AVAILABLE", data: data.data.listData.items });
      } catch(err) {
        console.log('error: ', err)
      }
    }
  }
  </code></pre>