Beautiful.
Up next, we have increased the amount of items in the car, so I have my items, each of them have
the amount, and then once I click on a button, I would want to increase that amount in the car.
Now, at the moment, we'll just the amount and then eventually, of course, we will set up our global
amount as far as how many items we have in the car and then the totals at the moment, we'll just deal
with the single amounts for each of the items we have in the car.
There's always the spiel is the same context is the first one.
And we go with CONSED and then I'll call this increase because I think it's is just going to be faster.
Again, we are looking forward.
Yeah, that is the same.
So we go with this patch here, we pass in the object and then I would want to go type and I'm going
to say increase now same thing we pass in the payload and that one is equal to Marty and you know,
just so we can speed up the process.
But I'll also pass in the pictures now.
I won't set up the functionality for both of them in the register, but since the setup is pretty much
the same, we have increase and decrease and the only thing that is changing is the type.
I say here, decrease.
Decrease in line, I would want to pass both of them down.
No, that's not what I wanted to do, let's say increase and decrease.
And now the structure, both of them in the item we have removed already and then we're going to go
with increase and decrease.
Let's save online.
What we're looking for is, of course, the on click, the moment we have to console logs where we have
the same thing removed, because if the first one is the increase and the second one will be decrease,
we increase, we pass in the area and the same thing will be decrease amount.
If you're lost a little bit, just look for the comments.
For the decrease, of course, have decreased amount and then for the increase, I have increased amount
and here we go, decrease and then again we pass in the area.
And of course, we will just need to handle that in the Rudisha.
So we go back over here, we have action type.
And then, of course, in this case, the action type is increased.
So we go with action and type is equal to increase.
And in this case, I will set up the separate variable because I think it's just going to be easier
to follow along.
So I'm going to go with let and then cart and for the time being is just going to be an empty array,
because first I would want to set up my return and I'll say, yep, I would want to return to state.
I don't want to change as far as other properties.
So of course we'll copy them and then I'll say the card value will be equal to my time card.
And of course at the moment it is an empty array, but we'll change that and a split second.
So we go with state, not as my own state.
I'm looking for the card.
And again, I would want to call in the map method.
So I would want iterate over the card that is before or the update.
And then here again, I'll call this card item that is going to be each item in the card.
And as I'm iterating over it.
What I would want is check if the item matches the idea that I'm passing and then, of course, I would
want to increase that amount properly in that item.
So here we say, if correct item, then it matches to the payload that I'm passing in that beautiful.
But I would want to change that item.
If not, then I simply want to return.
So I just return the cart item the way it is.
So I'm ordering over.
Each item is represented by the item and then I have my condition.
Whereas if Kameda matches the payload that I'm passing and awesome that increase that amount by one.
If not, then return the item from here.
Of course I just need to come up with my return where I'm going to say if that is the case, if the
ID matches, then I would want to return a new object.
I'll copy other properties from the car item because I don't want to change them.
However, the amount is the one that I would want to change.
So in here I'm going to say, yeah, there's going to be new value for the amount property and that
one will be cart item, that current amount and then plus one the reason why we have plus one because
of course we're increasing by one down here.
I had a tiny bag.
It should be action.
And then that payload, which you should notice is that once you click, we're increasing again.
It's not reflected in number or in total.
Don't worry, we're going to get that for now.
I just want to be able to increase this month, which, of course, I can do that.
Beautiful ones.
We have this one in place and of course, we'll start dealing with vigorish.