useEffect(() => {
console.log('component mounted!')
getLikedProduct()
},[])
async function getLikedProduct(){
try{
var snapshot = await firestore.collection("Likes").where("user","==",auth.currentUser.uid).where("timeStamp", ">", 1).orderBy("timeStamp","desc").get()
snapshot.forEach(doc => {
collectedProductId.push(doc.data().product)
})
setCollectedProductId(collectedProductId)
collectedProductId.forEach(async doc2=>{
var snapshot2 = await firestore.collection("Products").where("id","==",doc2).get()
snapshot2.forEach(doc => {
temp.push(doc.data());
setCollectedProduct(temp);
});
})
}
catch(e){
console.log(e)
}
}
this is my code and it does not render the data just i expected before I click touchable opacity of this page. Any clues or hints can I get to solve this problem?