✅ – Cooly – 23-00 Dec 24
how come "second" gets printed before "first" is there a way to make them print in the right order
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');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');