title: Filter firebase data by logged in user REACT
body: <p>I created an app using react and firebase for backend. I have fully working code to authenticate users, they can register and login successfully. They can as well create &quot;cards&quot; on the front end and they get stored on the firebase realtime database. I would like to only display (filter) Cards created by users to be able to be seen only by the user that created it. Right now all and any cards created by users are visible to all users.</p>
  <p>Here's how i am adding Cards to the firebase DB, i'm just not sure how to filter by UID:</p>
  <pre><code>useEffect(() =&gt; {
      const cardRef = firebase.database().ref('Cards')
      cardRef.on('value', (snapshot) =&gt; {
        const cards = snapshot.val()
        const cardslist = []
        for (let id in cards) {
          cardslist.push({id, ...cards[id] })
        }
        setCardslist(cardslist)
      })
    },[])
  </code></pre>
  <p>Here is the full project which you can fork and edit:
  <a href="https://codesandbox.io/s/firelog-lpfe5?file=/src/Hero.js:1942-2241" rel="nofollow noreferrer">https://codesandbox.io/s/firelog-lpfe5?file=/src/Hero.js:1942-2241</a></p>