title: Unable to fetch user id from firebase
body: <p>I am not able to fetch items with user id by typing <code>user?.uid</code> but when I enter the user ID manually it's working fine. I've checked if there is user id before by console logging it and it's showing normally</p>
  <p><a href="https://i.stack.imgur.com/Elczr.png" rel="nofollow noreferrer">enter image description here</a></p>
  <pre><code>    console.log(user?.uid)
  
  useEffect(() =&gt; {
        try{
          db.collection('users').doc(user?.uid).collection('trades')
          .onSnapshot((querySnapshot) =&gt; (
            setTradee(querySnapshot.docs.map(doc =&gt; ({
              id: doc.id,
              data: doc.data()
            })))
          ))
      }catch(err){
          alert(err)
      }
       
      },[])
  </code></pre>
  <p>this isn't working</p>
  <pre><code>useEffect(() =&gt; {
       try{
         db.collection('users').doc('jvchfGPeSaTlDw4POwCFHg1anhz1').collection('trades')
         .onSnapshot((querySnapshot) =&gt; (
           setTradee(querySnapshot.docs.map(doc =&gt; ({
             id: doc.id,
             data: doc.data()
           })))
         ))
     }catch(err){
         alert(err)
     }
      
     },[])
  </code></pre>
  <p>that works</p>