title: How to get a single document from firestore?
body: <p>According to the documentation from firebase you can get a document very simply by using <a href="https://firebase.google.com/docs/firestore/query-data/get-data#get_a_document" rel="nofollow noreferrer">get()</a></p>
  <p>But for some reason in my code it always displays that there's no such document, even though it does exist, this is what I'm doing:</p>
  <pre><code>useEffect(() =&gt; {
  
      console.log(user, &quot;This is the user UID:&quot;+user.uid)
      const userDoc = db.collection('usuarios').doc(user.uid);
      const doc = userDoc.get();
  
      if (!doc.exists) {
          console.log('No such document!');
      }
      
      else {
      userDoc
      .onSnapshot(snapshot =&gt; {
        
         const tempData = [];
         snapshot.forEach((doc) =&gt; {
           
           const data = doc.data();
           tempData.push(data);
   
         });
         setUserData(tempData);
       })
      }
  }, [user]);
  </code></pre>
  <p>This is what the <code>console.log()</code> shows:</p>
  <p><a href="https://i.stack.imgur.com/6jg1Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6jg1Y.png" alt="enter image description here" /></a></p>
  <p>This is how it looks in firebase:</p>
  <p><a href="https://i.stack.imgur.com/jojtj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jojtj.png" alt="enter image description here" /></a></p>