Getting a error message saying Parsing error: Can not use keyword \'await\' outside an async function from below code for Redux action.
Parsing error: Can not use keyword \'await\' outside an async function
What is the proper w
You need to have async keyword for the inner function
async
inner
export function getData() { return async (dispatch) => { try { const data = await API.graphql(graphqlOperation(query)) dispatch({ type: "DATA_AVAILABLE", data: data.data.listData.items }); } catch(err) { console.log('error: ', err) } } }