Awesome, and once we can successfully clear Hocutt, the next easiest functionality is going to be
removing a single item from the cart.
So we're going to navigate back to context jazz and we're going to come up with some kind of name.
We're going to say, you know what?
The function name will be removed right after clear.
We're going to go with Consed and then remove.
Now, in this case, though, we are looking for the idea that is important in this case, because,
of course, when we want to remove the item, we need to know, well, which item are we actually removed?
Correct.
So we go with this patch again.
We passing the object now type in this case is going to be removed again.
Common convention.
We set up everything uppercase and then we need to pass in that idea.
And then again, Common Convention is calling this bailout, but you can call it Bugs Bunny, you can
call it taco and burrito.
Doesn't really matter.
But in my case, I'm going to call this bailout.
And of course, I'll set it equal to the idee we save.
And of course, we would want to pass that function down.
And I can tell right away that as far as next functions, all of them will end up in one place.
And that is the card item, because in this current item, I would want to remove the item from the
cart.
I would want to increase or decrease.
So we navigate that.
We navigate to the cart item.
Of course, I'll close my sidebar and then I already have the use global context and I simply say Consed
and I have the structure and function and that is coming from my U.S. global context.
Of course I invoke it and this is the part where I do need to set up my inline function because I want
to personally remember when I showed you the overview of the setup, I said, yeah, we have the idea,
but at the moment we're not using our we will use it when we start hooking up everything as far as the
contact is concerned.
And in this case, I'll pass and my function remove and I'll pass in that.
So that will be that specific ID that is unique for every item that I have in the car.
And of course, the last thing, again, we just need to deal with that.
And the producer, again, we have.
And we would want to come up with the functionality and it's going to be a condition again, so if that
action and type and if it is equal to remove what I would want to do, well, again, let's think about
it.
I would want to return the old state.
Of course, I would still want to preserve my loadings, my totals and then my amounts.
But I would want to change the.
Now, if you want, you can set up a separate variable and undo the functionality here.
That is definitely the case.
But since I feel like a rebel, I'm going to do somewhat similar where I'm going to return to state
and then I'll do my functionality right here in the object.
But you don't have to.
You can set it up separately as well.
So we'll go with the return standard.
And then, of course, we're returning a state then again court and I'm looking for state.
So state before update.
There is a court array and I can just filter correct.
And something that we have already done over the projects and I would want to say 50 times is to grab
the values, the items whose IDs do not match.
So I'm passing in the payload theory of the item that I would want to remove.
And I'm just going to say cart item.
That is every item in my.
And if the cart item ID does not match the idea that I'm passing in the payload, beautiful, then that
item will be returned.
So we go and action and then payload luxo.
However, if the item rematches then of course that is the item that I would want to remove.
So it is not going to be in my car.
And there is now I can just simply say, yep, this item is gone.
This item is gone as well as this one.
So now, of course, we go back to the empty car.
Now, if you want, of course, you can navigate to the bigger screen and take a look at the components
left.
But in my case, we'll move on to our next piece of functionality.