OK, so next, we'll add the remove functionality, like whenever the user want to remove a particular
product from his bag or card.
So what will happen if that the user presses that remove button?
Let me show you what I'm talking about, exactly.
So how do you see this remove button?
So what happens if the user presses this remove button?
Right now, we have added the functionality to this clear button, like whenever the user will press
this clear card.
So what will happen that we have already done that part, but now is the turn of this removal button?
But okay, so we'll do that after this if statement will add another statement.
If we provide a base here.
After that, another statement and that will be action dart type is equally equal to.
Remove.
Oregon City Move items, whatever.
We will go with the move.
And what is the thing which needs to be redone inside this will provide a return.
And.
Inside the curly braces will provide the sprayed operator like we want to return the state, but we
also want to return the updated guide that will be carved.
And the colon.
And here that will be stayed dark guard.
Start when you start.
Now we're filtering, not according to what that will see next.
So.
Peter?
And that will be a function inside guard item.
It was card item.
Or just.
I can't remember that.
OK, maybe we'll go with the cart item.
OK, so.
This is a function of federal function.
And here, the guard.
Item thought I.D..
Does not equal a call to action start.
Phil Lord.
So we'll provide a comprehensive.
Next will feel right for the increase and decrease button, so we'll right if.
Action Lord, the Lord.
Not our payload action or Typekit basically action or type equally quick to increase.
Greece.
So for that, we'll right.
So first of all, we'll do like increase the increase, the previous value will need our temporary variable,
so we'll ride.
Let.
Thank guard.
Then cart is equal to.
A dark guard dark map now will map the data from the card item and.
Inside this, there's a function and.
Basically, we don't need to import this guard item here, and we'll just delete this.
And.
This.
OK, so now what, we accidentally imported the cart item component, but we don't need it, actually,
this is just too variable.
Nothing else which we are passing as an argument here.
So don't be confused that cart item component is different, and this cart item is a variable, which
we are passing as an argument inside this filter function.
OK, so next, let's go and map the data.
So for mapping the data?
We'll see in the increase.
We'll see.
We have already created a temporary guard which will store this map map data.
Now we'll see if the guard.
I don't doubt it is equally call to action.
Not payload allowed.
So they've done this, they're done what they've done, this raid on this object.
And spread the card item using the spread operator.
Guard item.
There you go.
An amount would be.
Item plus one.
Now why I have done this.
Let me tell you in a second.
This is to increase the number, which is displayed just after the bag on the nav box.
Like whenever you increase the quantity, the quantity increases and in the bottle also.
So that is what which we have done here and added error because we have not provided one extra.
Battle parenthesis will wrap it inside this now that daughter will be gone.
No, it's not.
Because in order to be going.
So now what we do is we need to return our default like whenever we press the button.
But after that, we need to import.
We need to return a default state.
You know, to after this return will return or default return card item.
Now, I forgot to close this parenthesis, and that will be closed here.
And there would be a semicolon force.
And after that, there will be another written statement written an object with state guard.
Ben Boogaard.
Yeah, the accepting variable, which which we created inside to increase this function.
OK.
So I think this is for the increase one.
Now what we'll do is we'll create a decrease decrease, but things will be seen.
Things will be almost the same.
Let me just copy this if.
This increase won, and let me be.
Now, what are the two unions which will be there?
First of all, this increase will change or decrease.
Next, guard item will be not plus one, it will be minus one.
All right.
And I don't think there is much enough to change.
These are the only two things which are there for her.
Also will be needing a temp card.
So yeah.
Did we filter out something?
Yeah, we need to fill that, like after the return of the guard item, after the guard item returns.
So we need to see if it's not zero because whenever look, whenever we are decreasing the number of
products like, for example, there are three, the quantity of the is three.
And now we are decreasing.
We press the decrease button.
Once that comes to be pressed again, that comes one.
But after one, if you press the button of decrease the value of that, the quantity of the product
will be zero.
And once the quantity of the product becomes zero, that means that simply means that the product is
being deleted from the cart, right?
If the quantity of the product is zero, that means the product is no longer exist in our bag or on
the cart.
So that means we need to delete it so that functionality will add.
OK, so we'll map, of course, after the return cart item.
What we'll do is we'll filter out here.
We'll add a filter.
Well, they're going to be filled up and inside this will add.
We'll expect to function inside this field pass argument of but I don't and who will vote.
We'll check if the card item is equal to zero or not, so card item is not equal to zero.
Then you need to return the state and everything else.
So.
And right on one thing.
After that, if.
This is for the desert, for other degrees.
OK, now we'll be moving on to the brutal part, like whenever we increase the number of product or
decrease the number of product.
The impact of this action would be directly seen in the total amount in a bag, like the total amount
and drops we have to which we have to pay.
That amount will be definitely affected.
Whenever we add, we add or remove something from the cart, right?
So that part, we really do not.
Right now, we have just done it for the quantity to decrease and increase the quantity.
But what about the amount?
The amount will also be affected.
The price would also be affected by adding or removing something from the cart, right?
So that will do in the next video.