search

Home  >  Q&A  >  body text

Access data from Firebase collections

I'm trying to read information from a Firebase collection in React, but I can only read one using this code. Can anyone help me?

This is my code, returns only one element

async function(){
  const docRef = doc(db, "transactions/yaounde/income/GWL5xaGgrSvmaYNXhSLx");
  const docSnap = await getDoc(docRef);
  if (docSnap.exists()) {
    console.log("Document data:", docSnap.data());
  } else {
    console.log(docSnap.data())
    console.log("No such document!");
  }
};

I've tried reducing the number of quoted midsections but it returns undefined

P粉201448898P粉201448898255 days ago330

reply all(1)I'll reply

  • P粉023326773
  • Cancelreply