We can remove items from our cart.
So now let's start working on the increase and decrease, and again, we're going to do a bit of a set
up first and then one by one, we'll take a look at the functionality because they're a bit more complicated
than just remove or clearing the cart.
So I'm going to start by setting up the cart item where instead of just having a remove prop course,
I also would want to have props for increase and decrease.
So let me start a new line and line in this case.
Maybe let me make this one smaller.
It's going to be easier for me to copy and paste and copy and paste and maybe right away add some commas
here.
And as far as the names we're going to go with increase.
Increase and then decrease, decrease.
So what things we need to change here?
Well, of course, we're not going to dispatch or move or increase.
We would want to dispatch increase.
We'll still pass the payload because we will look for that specific item.
So that will stay the same.
But as far as the decrease.
I also want to check the amount, the amount that is in the home perhaps.
So why we're checking the amount because if we're taking a look at the finished application, you can
see that I can increase costs for all of them.
But then as far as decreasing, if the amount for that specific item is more than one, well, then
we'll just decrease the item here and here.
But if the amount is less than one, then we just remove it from the cart.
That's why not only we will pass the ID like we have for remove and increase.
We also will be structured from the on perhaps the amount and I again remember it is in the actual core
items.
So you can clearly see that particular property there.
And then in the payload, not only will pass the ID like we have done already for over an increase,
but we will also do the same thing with the amount.
So those are two things we will need in decrease.
So extra will be an amount.
And then since I have both of these props right now.
I can scroll up and not only I'm looking for her move, I'm also looking for increase and decrease and
I can already see that I'm not using my variable.
Of course, there will be a mistake.
So now let me change the decrease action type to a decrease.
My apologies.
Now let's continue.
We have increase and then, of course, we have decreased and the setup will be exactly the same like
we have for remove.
Let me just point those buttons.
I can see that I have increased amount and decrease the amount.
So same spiel we go with on oncolytic is equal to overall function since we would want to run it when
we click on a button.
So in this case, since it is increase, I'm going to invoke my increased prop and then I'm also going
to do the same thing with my decrease button.
But in order to speed things up, I'm just going to copy what we wrote and copy and paste it here where
I have the decrease button.
And of course, the only thing we need to change right now is the prop or the function that we will
invoke.
So instead of increase, we will go with decrease.
Now, again, let me click.
We should see you increase the amount.
Awesome.
Now works.
And then also we should help you decrease the amount.
So we correctly connected our car item component to our dispatch.
So now of course, we just need to take care of the functionality in the user.