title: Using Async/Await in firebase | react-redux | react-native
body: <p>The code works, but I was wondering if someone could help me translate that into a better async/await syntax. </p>
  
  <p>The code is fetching data using firebase api and handling the response with react-redux and thunk middleware. </p>
  
  <p>I'm building an React-Native app. The "forEach" in "childSnapshot" is where I can't seem to make it neater, and I needed that to sort the score values in JSON => <a href="https://stackoverflow.com/questions/40382225/node-js-firebase-orderbychild-not-working">Node.js + Firebase orderByChild not working</a> </p>
  
  <pre><code>  export const getScores = () =&gt; async dispatch =&gt; {
    try {
      let res =[];
      await firebase.database().ref("game_score_ref").orderByChild("score").once("value", snapshot =&gt; {
        snapshot.forEach(childSnapshot =&gt;{
          res.push(childSnapshot.toJSON())
        })
      });
      dispatch({ type: GET_SCORES, payload: res });
    }catch(err){
      dispatch({ type: GET_SCORES_ERROR, payload: err });
    }
  }
  </code></pre>
  
  <p>Any suggestions would be greatly appreciated!</p>