TypeError: firebase_firestore__WEBPACK_IMPORTED_MODULE_6__.doc.data is not a function

Viewed 8

this is where problem is arising here getting data from the firebase

      14 | useEffect(() => {
      15 |   const q = query(collection(db, "posts"))
      16 |   const Unsubscribe= onSnapshot(q, 
          (querySnapshot) => {
            //error is here in this line
    > 17 |     console.log("Data", querySnapshot.docs.map(d 
             => doc.data()));
         | ^  18 |   });
      19 |   return Unsubscribe;
      20 | }, [])

please help if anybody knows why is it happening when I start this, the app runs for a second, and then this error pops up.

0 Answers
Related