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

164
Views
I have some documents names of a collection of firebase firestore in an array, want to fetch data , how do Implement await?
  • I have an array of uid =["doc name 1","doc name 2"....]
  • I have some data in firestore > "collection Name" > docmunets (uid which I have in above array ) > some data
  • want to extract all data of all documents which are in uid array ,
  • I'm using this code.. but problem is for loop dont wait for data to be fetched and then go to next iteration.
  • how do I wait for every iteration to be completed. (await / async)
  • here PostData.requests is an array which mentioned as uid
  • here db is firebase firestore database ref
 useEffect(() => {
       if(PostData.requests==[]){
           setPageLoaded(true)
           
       }
       else{
            
        PostData.requests.forEach((element) => {
            db.collection("userPersonalData").doc(element).get().then((data)=>{
               let EachD = {key:element,Name:data.Name,url:profileDp}
               setFlatListData(EachD,...FlatListData)
           }).catch((e)=>{
               console.log(e);
           })
           setPageLoaded(true)
       });
           
       }
  
   }, [])
about 4 years ago · Juan Pablo Isaza
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!