coolyC
Reactiflux4y ago
24 replies
cooly

✅ – Cooly – 23-00 Dec 24

await ref.recipes.forEach(async(doc) => {
await firebase.firestore().collection("recipes").doc(doc).get()
      .then ((snap) => {
        if (snap.exists) {
          tempList.push(snap.data());
          setDataList(tempList);
          console.debug('first');
      })
      .catch((error) => {
        alert(error.message);
      })
    })
  }
console.debug('second');

how come "second" gets printed before "first" is there a way to make them print in the right order
Was this page helpful?