I am attempting to filter out a specific item from the list by using its index.
For example, if I want to remove the item with index 0, I would pass the number 0 to the filter function in order to return all objects except for the one at position 0.
Below is the current implementation:
function removeCartItemHandler(index) {
console.log(index)
if (index != -1) {
cart = cart.splice(index, 1);
cart.filter(cart[index]);
setCartItems(cart);
}
console.log(cart)
}