I'm trying to increase the quantity count of an existing object in my shopping cart instead of adding it again. Objects look like this:
{
id: 2,
name: "Squash Supreme",
selectedSize: "38",
price: 75,
quantity: 1
}
With .includes() I tried to verify if the exact object already exists in the array, but couldn't. Tumbled over .find() .some() etc. but none of the examples took two key-value pairs.
I need to check if an object with two identical key-value pairs (id and selectedSize) is already present.
Any suggestions? (I'm using react, with functional components, Array is in an useState.)
After that I can tackle the increment functionality ;) Thanks in advance!
 
    