Reordering of cart products is due to filtering the cart items to remove the found product followed by appending the mutated found product to the end of the cart. Instead, simply mapping over the items and returning an updated item for the specific item we are searching would preserve the order.
toggleCartItemQuantity function in stateContext
Reordering of cart products is due to filtering the cart items to remove the found product followed by appending the mutated found product to the end of the cart. Instead, simply mapping over the items and returning an updated item for the specific item we are searching would preserve the order.