title: Firebase transaction in React Native
body: <p>I've set up Firebase and it's all working fine. Now I want to increment a value when someone presses on a name, at the first moment I thought 'let's just update it'. But quickly I saw that this was not the right way. I'm creating a really simple multiplayer game, so there is a chance someone else presses this name at the same moment. This will give a problem.</p>
  
  <p>I looked it up and found out that Firebase transaction is the right approach, I looked up some tutorials, and came up with the following code:</p>
  
  <pre><code>   const renderList = ({ item }) =&gt; {
          return (
              &lt;ListItem
                  style={{
                      marginTop: 10,
                      width: 380,
                  }}
                  roundAvatar
                  title={playerList[item].username}
                  subtitle={item.subtitle}
                  onPress={() =&gt; {
                      logIn(roomId, playerList[item].username)
                  }}
              /&gt;
          )
      };
  
  
    const increasePress = () =&gt; {
              const myRef = firebase.database().ref('MP/rooms/testroom/participants/Max/')
              await firebase.firestore().runTransaction((transaction) =&gt; {
                  const snapshot = await transaction.get(myRef);
  
                  return snapshot.update(myRef,'press',snapshot.data().press + 1)
              });
          }
  
  
      useEffect(() =&gt; {
          ownParticipantRoom.update({
              username: username,
              host: isHost,
              press: 9,
              connected: 1,
          })
      }, [gamePercentage])
  </code></pre>
  
  <p>I know that the first reason this is not working, is because I'm using Await outside an async function. However I've never used this. How can I fix it?</p>