I've a list of items I need to individually wait time for:
const products = [{
itemID: 1,
name: 2,
remainingTime: 600
},
{
itemID: 12,
name: 333,
remainingTime: 300,
}]
I'm trying to add popup is any of the product remaining time <= 100s doing something like this:
products.map((product) => {
let remainingTime = product.remainingTime;
useEffect(() => {
if (remainingTime <= 100){
addPopup("Time Expiring")
}
}, [remainingTime])
})
But react won't let me add useEffect inside the map. Is there a better way to accomplish this?