Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
i am getting only one document from the collection of firebase for different id
 const { id } = useParams();
  const [detailData, setDetailData] = useState({});
  useEffect(() => {
    const q = query(collection(db, "movie"));
    onSnapshot(q, (querySnapshot) => {
      querySnapshot.docs.map((doc) => {
        if (doc.exists) {
           setDetailData(doc.data());
        } else {
          console.log("no doc");
        }
      })
      .catch((error) => {
        console.log("Error:", error);`enter code here`
      });
    });
  }, [id]);

how can i pass id of document in this code tried lots of tutorials and official documentation also .

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

QuerySnapshot.docs returns an array of QuerydocumentSnapshot which has an id field:

https://firebase.google.com/docs/reference/node/firebase.firestore.QueryDocumentSnapshot

This is located outside of the doc.data field. Doc.data contains the data in your DB object.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!