I was making an E-commerce website using react. I added a few items in the cart and went to the cart page. I made a counter to increase or decrease the number of items.
Where does id in JSX come from?
What is this line doing: uniqueItemsInCart.map((item) => item.id === id)?
On what condition setNumber in updateQuantity won’t be executed?
Why you posted only some random lines instead of something executable?
you won’t know if people will look at 10 files of code, unless your try sharing your github repo.
nonetheless, i think your map function created an array of every item.id.
try debugging and the value of [id, and item.id], or console.log them to see if they have an array value
I wonder if you succeeded in debugging it, considering it’s been a while since you’ve created this thread. I agree with @Sboonny idea. Maybe I’m wrong, but I doubt it. In any case, I could reach some of my whiz friends and ask them for their opinion. I need to know if you still need help. Moreover, considering you’re a newbie in dealing with e-commerce platforms, I highly suggest you consider downloading any chrome extension for salesforce. I hope you’re doing great, and I’m keenly waiting for your reply. Cheers.