1
00:00:00,570 --> 00:00:06,960
OK, so next, we'll add the remove functionality, like whenever the user want to remove a particular

2
00:00:06,960 --> 00:00:09,420
product from his bag or card.

3
00:00:09,990 --> 00:00:14,610
So what will happen if that the user presses that remove button?

4
00:00:15,090 --> 00:00:17,430
Let me show you what I'm talking about, exactly.

5
00:00:18,450 --> 00:00:20,700
So how do you see this remove button?

6
00:00:21,060 --> 00:00:23,880
So what happens if the user presses this remove button?

7
00:00:24,960 --> 00:00:30,120
Right now, we have added the functionality to this clear button, like whenever the user will press

8
00:00:30,120 --> 00:00:31,080
this clear card.

9
00:00:31,530 --> 00:00:37,290
So what will happen that we have already done that part, but now is the turn of this removal button?

10
00:00:38,290 --> 00:00:46,600
But okay, so we'll do that after this if statement will add another statement.

11
00:00:48,350 --> 00:00:50,150
If we provide a base here.

12
00:00:52,150 --> 00:01:01,030
After that, another statement and that will be action dart type is equally equal to.

13
00:01:04,790 --> 00:01:05,650
Remove.

14
00:01:08,440 --> 00:01:10,120
Oregon City Move items, whatever.

15
00:01:10,360 --> 00:01:11,770
We will go with the move.

16
00:01:12,560 --> 00:01:18,550
And what is the thing which needs to be redone inside this will provide a return.

17
00:01:21,700 --> 00:01:22,360
And.

18
00:01:24,360 --> 00:01:31,950
Inside the curly braces will provide the sprayed operator like we want to return the state, but we

19
00:01:31,950 --> 00:01:37,590
also want to return the updated guide that will be carved.

20
00:01:39,590 --> 00:01:40,520
And the colon.

21
00:01:43,080 --> 00:01:46,290
And here that will be stayed dark guard.

22
00:01:48,270 --> 00:01:49,260
Start when you start.

23
00:01:49,830 --> 00:01:53,760
Now we're filtering, not according to what that will see next.

24
00:01:54,630 --> 00:01:55,050
So.

25
00:01:57,740 --> 00:01:58,250
Peter?

26
00:02:00,240 --> 00:02:04,770
And that will be a function inside guard item.

27
00:02:08,100 --> 00:02:09,630
It was card item.

28
00:02:11,080 --> 00:02:12,550
Or just.

29
00:02:13,970 --> 00:02:15,070
I can't remember that.

30
00:02:15,570 --> 00:02:17,840
OK, maybe we'll go with the cart item.

31
00:02:18,080 --> 00:02:19,610
OK, so.

32
00:02:21,400 --> 00:02:23,380
This is a function of federal function.

33
00:02:24,190 --> 00:02:25,570
And here, the guard.

34
00:02:28,580 --> 00:02:30,650
Item thought I.D..

35
00:02:34,010 --> 00:02:38,770
Does not equal a call to action start.

36
00:02:39,500 --> 00:02:40,100
Phil Lord.

37
00:02:41,870 --> 00:02:43,820
So we'll provide a comprehensive.

38
00:02:45,900 --> 00:02:53,820
Next will feel right for the increase and decrease button, so we'll right if.

39
00:02:57,150 --> 00:02:59,460
Action Lord, the Lord.

40
00:03:02,260 --> 00:03:10,150
Not our payload action or Typekit basically action or type equally quick to increase.

41
00:03:12,410 --> 00:03:12,910
Greece.

42
00:03:13,640 --> 00:03:17,150
So for that, we'll right.

43
00:03:19,070 --> 00:03:26,940
So first of all, we'll do like increase the increase, the previous value will need our temporary variable,

44
00:03:26,940 --> 00:03:27,750
so we'll ride.

45
00:03:28,950 --> 00:03:29,460
Let.

46
00:03:30,810 --> 00:03:31,740
Thank guard.

47
00:03:34,570 --> 00:03:36,280
Then cart is equal to.

48
00:03:37,330 --> 00:03:46,780
A dark guard dark map now will map the data from the card item and.

49
00:03:48,530 --> 00:03:52,070
Inside this, there's a function and.

50
00:03:53,660 --> 00:03:58,730
Basically, we don't need to import this guard item here, and we'll just delete this.

51
00:03:59,810 --> 00:04:00,560
And.

52
00:04:01,790 --> 00:04:02,180
This.

53
00:04:04,140 --> 00:04:10,740
OK, so now what, we accidentally imported the cart item component, but we don't need it, actually,

54
00:04:10,740 --> 00:04:11,850
this is just too variable.

55
00:04:12,480 --> 00:04:15,730
Nothing else which we are passing as an argument here.

56
00:04:16,440 --> 00:04:23,310
So don't be confused that cart item component is different, and this cart item is a variable, which

57
00:04:23,310 --> 00:04:26,970
we are passing as an argument inside this filter function.

58
00:04:27,000 --> 00:04:32,370
OK, so next, let's go and map the data.

59
00:04:33,250 --> 00:04:34,470
So for mapping the data?

60
00:04:36,270 --> 00:04:37,920
We'll see in the increase.

61
00:04:38,130 --> 00:04:38,940
We'll see.

62
00:04:39,270 --> 00:04:46,680
We have already created a temporary guard which will store this map map data.

63
00:04:47,040 --> 00:04:50,430
Now we'll see if the guard.

64
00:04:51,480 --> 00:04:56,460
I don't doubt it is equally call to action.

65
00:04:59,890 --> 00:05:00,730
Not payload allowed.

66
00:05:02,590 --> 00:05:10,750
So they've done this, they're done what they've done, this raid on this object.

67
00:05:11,880 --> 00:05:15,140
And spread the card item using the spread operator.

68
00:05:17,010 --> 00:05:17,670
Guard item.

69
00:05:18,700 --> 00:05:19,370
There you go.

70
00:05:19,780 --> 00:05:21,880
An amount would be.

71
00:05:25,580 --> 00:05:28,010
Item plus one.

72
00:05:28,160 --> 00:05:29,960
Now why I have done this.

73
00:05:30,380 --> 00:05:31,730
Let me tell you in a second.

74
00:05:33,010 --> 00:05:39,730
This is to increase the number, which is displayed just after the bag on the nav box.

75
00:05:40,570 --> 00:05:46,830
Like whenever you increase the quantity, the quantity increases and in the bottle also.

76
00:05:47,800 --> 00:05:56,770
So that is what which we have done here and added error because we have not provided one extra.

77
00:05:57,960 --> 00:06:03,000
Battle parenthesis will wrap it inside this now that daughter will be gone.

78
00:06:06,900 --> 00:06:08,010
No, it's not.

79
00:06:11,190 --> 00:06:13,260
Because in order to be going.

80
00:06:15,730 --> 00:06:24,400
So now what we do is we need to return our default like whenever we press the button.

81
00:06:24,850 --> 00:06:26,810
But after that, we need to import.

82
00:06:26,830 --> 00:06:28,900
We need to return a default state.

83
00:06:28,940 --> 00:06:39,310
You know, to after this return will return or default return card item.

84
00:06:42,350 --> 00:06:49,340
Now, I forgot to close this parenthesis, and that will be closed here.

85
00:06:52,950 --> 00:06:55,240
And there would be a semicolon force.

86
00:06:56,340 --> 00:07:09,720
And after that, there will be another written statement written an object with state guard.

87
00:07:11,760 --> 00:07:12,420
Ben Boogaard.

88
00:07:13,920 --> 00:07:20,370
Yeah, the accepting variable, which which we created inside to increase this function.

89
00:07:20,880 --> 00:07:21,170
OK.

90
00:07:22,160 --> 00:07:25,700
So I think this is for the increase one.

91
00:07:26,750 --> 00:07:31,660
Now what we'll do is we'll create a decrease decrease, but things will be seen.

92
00:07:32,600 --> 00:07:34,460
Things will be almost the same.

93
00:07:35,780 --> 00:07:37,880
Let me just copy this if.

94
00:07:39,350 --> 00:07:41,490
This increase won, and let me be.

95
00:07:42,680 --> 00:07:44,600
Now, what are the two unions which will be there?

96
00:07:44,720 --> 00:07:46,970
First of all, this increase will change or decrease.

97
00:07:49,910 --> 00:07:54,620
Next, guard item will be not plus one, it will be minus one.

98
00:07:55,400 --> 00:07:55,800
All right.

99
00:07:56,900 --> 00:08:00,530
And I don't think there is much enough to change.

100
00:08:01,010 --> 00:08:05,010
These are the only two things which are there for her.

101
00:08:05,030 --> 00:08:07,010
Also will be needing a temp card.

102
00:08:07,790 --> 00:08:09,490
So yeah.

103
00:08:11,350 --> 00:08:12,700
Did we filter out something?

104
00:08:13,950 --> 00:08:21,560
Yeah, we need to fill that, like after the return of the guard item, after the guard item returns.

105
00:08:22,430 --> 00:08:30,710
So we need to see if it's not zero because whenever look, whenever we are decreasing the number of

106
00:08:30,710 --> 00:08:35,870
products like, for example, there are three, the quantity of the is three.

107
00:08:36,200 --> 00:08:37,460
And now we are decreasing.

108
00:08:37,460 --> 00:08:38,810
We press the decrease button.

109
00:08:38,810 --> 00:08:42,860
Once that comes to be pressed again, that comes one.

110
00:08:43,100 --> 00:08:50,150
But after one, if you press the button of decrease the value of that, the quantity of the product

111
00:08:50,150 --> 00:08:50,720
will be zero.

112
00:08:51,080 --> 00:08:56,720
And once the quantity of the product becomes zero, that means that simply means that the product is

113
00:08:56,720 --> 00:08:58,250
being deleted from the cart, right?

114
00:08:58,950 --> 00:09:03,780
If the quantity of the product is zero, that means the product is no longer exist in our bag or on

115
00:09:03,780 --> 00:09:04,160
the cart.

116
00:09:04,430 --> 00:09:07,810
So that means we need to delete it so that functionality will add.

117
00:09:08,160 --> 00:09:13,550
OK, so we'll map, of course, after the return cart item.

118
00:09:14,060 --> 00:09:17,360
What we'll do is we'll filter out here.

119
00:09:17,900 --> 00:09:18,920
We'll add a filter.

120
00:09:20,420 --> 00:09:25,910
Well, they're going to be filled up and inside this will add.

121
00:09:29,730 --> 00:09:38,490
We'll expect to function inside this field pass argument of but I don't and who will vote.

122
00:09:39,150 --> 00:09:50,090
We'll check if the card item is equal to zero or not, so card item is not equal to zero.

123
00:09:51,590 --> 00:09:56,110
Then you need to return the state and everything else.

124
00:09:57,040 --> 00:09:57,490
So.

125
00:09:59,760 --> 00:10:02,520
And right on one thing.

126
00:10:03,880 --> 00:10:05,320
After that, if.

127
00:10:07,400 --> 00:10:09,800
This is for the desert, for other degrees.

128
00:10:10,100 --> 00:10:17,180
OK, now we'll be moving on to the brutal part, like whenever we increase the number of product or

129
00:10:17,180 --> 00:10:18,500
decrease the number of product.

130
00:10:19,640 --> 00:10:27,980
The impact of this action would be directly seen in the total amount in a bag, like the total amount

131
00:10:28,190 --> 00:10:30,530
and drops we have to which we have to pay.

132
00:10:30,920 --> 00:10:33,340
That amount will be definitely affected.

133
00:10:33,350 --> 00:10:37,190
Whenever we add, we add or remove something from the cart, right?

134
00:10:37,490 --> 00:10:39,010
So that part, we really do not.

135
00:10:39,440 --> 00:10:45,050
Right now, we have just done it for the quantity to decrease and increase the quantity.

136
00:10:45,230 --> 00:10:46,640
But what about the amount?

137
00:10:46,640 --> 00:10:48,080
The amount will also be affected.

138
00:10:48,080 --> 00:10:51,920
The price would also be affected by adding or removing something from the cart, right?

139
00:10:52,070 --> 00:10:54,650
So that will do in the next video.
