1
00:00:00,270 --> 00:00:08,490
OK, so now what we'll do is we'll calculate the amount according to the product and cart, according

2
00:00:08,490 --> 00:00:11,470
to the quantity, we'll calculate the total amount.

3
00:00:11,490 --> 00:00:13,740
OK, so for that also, we need to write a case here.

4
00:00:14,430 --> 00:00:26,510
So that is if action dart type type type is equal equal to get totals.

5
00:00:26,860 --> 00:00:28,290
Now what are the totals?

6
00:00:28,890 --> 00:00:32,700
This will be responsible for the total amount in the bag.

7
00:00:33,920 --> 00:00:34,780
That totals.

8
00:00:36,900 --> 00:00:39,480
And this will be.

9
00:00:41,270 --> 00:00:41,780
Lack.

10
00:00:45,000 --> 00:00:46,680
And we try to tell.

11
00:00:49,080 --> 00:00:53,460
It provided the total here, and we provided the amount also.

12
00:00:58,210 --> 00:00:58,780
And.

13
00:01:00,120 --> 00:01:01,500
That will be cool to.

14
00:01:02,690 --> 00:01:03,980
Did Derkach?

15
00:01:05,350 --> 00:01:06,610
So reduce.

16
00:01:08,470 --> 00:01:08,740
OK.

17
00:01:09,620 --> 00:01:10,810
So inside this.

18
00:01:12,270 --> 00:01:13,950
There will be a function.

19
00:01:15,420 --> 00:01:19,770
Vital to function, and there will be some arguments which will be passed for card.

20
00:01:21,160 --> 00:01:21,940
Total.

21
00:01:24,070 --> 00:01:24,970
And the guard.

22
00:01:26,140 --> 00:01:28,420
Item will be passed here.

23
00:01:29,960 --> 00:01:39,380
And inside, this will set the price also and will set the total item total also in right contest.

24
00:01:41,650 --> 00:01:44,430
Price and amount.

25
00:01:45,850 --> 00:01:49,630
That will be cool like that, that we're grabbing from the guard item.

26
00:01:51,460 --> 00:01:55,870
God, I don't know what is this?

27
00:01:56,560 --> 00:01:56,800
Yeah.

28
00:01:57,520 --> 00:02:01,870
Next, we'll set the item total go on item.

29
00:02:04,090 --> 00:02:06,760
Total is equal to.

30
00:02:08,010 --> 00:02:08,880
Rise.

31
00:02:10,230 --> 00:02:10,980
And to.

32
00:02:12,030 --> 00:02:13,830
Among simple.

33
00:02:15,200 --> 00:02:19,400
This amount of the total number of the products, nothing else like this is the price.

34
00:02:19,910 --> 00:02:26,620
Now, for example, we bought five or three phones, so the total amount would be three into the price

35
00:02:26,630 --> 00:02:27,880
of one form simple.

36
00:02:29,570 --> 00:02:33,860
Next, we'll set the car total.

37
00:02:34,960 --> 00:02:35,490
Got.

38
00:02:36,800 --> 00:02:40,160
Total, not total.

39
00:02:42,260 --> 00:02:49,360
Plus, an equal this policies and that will be item total simple.

40
00:02:49,880 --> 00:02:51,560
Next, we have the total amount.

41
00:02:54,260 --> 00:02:55,180
Our total.

42
00:02:56,440 --> 00:02:57,340
So our time on.

43
00:02:58,380 --> 00:03:01,740
That's an equal to amount.

44
00:03:02,610 --> 00:03:03,120
Simple.

45
00:03:04,260 --> 00:03:04,770
Oh.

46
00:03:06,110 --> 00:03:07,340
That will provide.

47
00:03:08,560 --> 00:03:09,430
The total.

48
00:03:10,700 --> 00:03:11,630
After this.

49
00:03:14,960 --> 00:03:15,590
Total.

50
00:03:17,210 --> 00:03:17,750
Zero.

51
00:03:18,800 --> 00:03:24,800
And among them is also, you know, as of now, no.

52
00:03:26,630 --> 00:03:30,050
After this particular and thesis here.

53
00:03:31,020 --> 00:03:36,870
What we'll do is we'll see the total is equal to the past float.

54
00:03:38,720 --> 00:03:41,520
As flawed and total.

55
00:03:43,690 --> 00:03:45,400
Thought you fixed?

56
00:03:46,870 --> 00:03:54,010
There's a JavaScript function, remember, this has nothing to do with react to to know what this line

57
00:03:54,010 --> 00:04:00,940
of code means is that whenever we are adding up the amount and if we get a decimal value, the floating

58
00:04:00,940 --> 00:04:10,210
point value so that Schnorr display like after the decimal, it's not display more than to two digits,

59
00:04:10,540 --> 00:04:12,190
but that is what this line is doing.

60
00:04:12,190 --> 00:04:13,000
Nothing great.

61
00:04:13,180 --> 00:04:14,440
Nothing so complex.

62
00:04:14,800 --> 00:04:15,160
OK.

63
00:04:16,750 --> 00:04:17,290
Next.

64
00:04:19,100 --> 00:04:20,000
We'll return.

65
00:04:21,330 --> 00:04:21,930
The state.

66
00:04:24,010 --> 00:04:31,450
Right on why I'm doing this type of return, but I don't put it on it.

67
00:04:32,320 --> 00:04:37,360
Next, we'll return the total as well as the amount.

68
00:04:38,300 --> 00:04:46,760
Bad enough, but this was in the labor is not in the parentheses because this is an object.

69
00:04:47,380 --> 00:04:49,460
Not at all.

70
00:04:49,790 --> 00:04:50,960
Our single variable.

71
00:04:50,990 --> 00:04:54,860
OK, now we'll write the case for the loading.

72
00:04:54,890 --> 00:05:03,050
Now what happens when the data is being phased from the EPA and the state is set to loading like the

73
00:05:03,050 --> 00:05:04,370
loading the third to true?

74
00:05:04,490 --> 00:05:06,050
So what will happen so that?

75
00:05:07,960 --> 00:05:09,010
We'll see now.

76
00:05:10,030 --> 00:05:13,030
There is nothing complex there, just one line of code here.

77
00:05:13,750 --> 00:05:15,070
So after this?

78
00:05:16,170 --> 00:05:18,720
We'll see that if.

79
00:05:22,280 --> 00:05:26,330
Action Dati is equal, equal to nerding.

80
00:05:29,830 --> 00:05:30,820
Loading.

81
00:05:37,570 --> 00:05:39,160
Then what we need to return.

82
00:05:41,510 --> 00:05:42,470
We need to return.

83
00:05:44,390 --> 00:05:52,160
The state using a spirit operator and loading is that to throw?

84
00:05:55,100 --> 00:05:55,820
Now.

85
00:05:57,160 --> 00:06:06,730
I never this if if if a statement is executed, that means the lowering will be set to true.

86
00:06:07,690 --> 00:06:08,030
OK.

87
00:06:09,380 --> 00:06:14,930
That is the only job this court will do in our next will try to display the items.

88
00:06:16,010 --> 00:06:16,640
So if?

89
00:06:19,230 --> 00:06:19,950
Action.

90
00:06:23,030 --> 00:06:23,980
The type.

91
00:06:24,950 --> 00:06:25,670
Not Coma.

92
00:06:26,330 --> 00:06:26,630
Not.

93
00:06:27,750 --> 00:06:36,330
The action or type is equal, equal to equal, equal, equal to display items.

94
00:06:40,120 --> 00:06:44,740
Display items, so now what we need to return for this simple.

95
00:06:45,700 --> 00:06:55,780
We'll start downloading two falls and everything else would be just exactly the same date and the loading

96
00:06:55,780 --> 00:06:57,950
and first of all, it fade.

97
00:06:57,970 --> 00:07:01,960
The cart should be the action door.

98
00:07:04,710 --> 00:07:05,280
Not.

99
00:07:06,940 --> 00:07:11,930
Payload and the loading will be set to false.

100
00:07:13,110 --> 00:07:14,730
Simple, simple.

101
00:07:15,750 --> 00:07:16,080
Now.

102
00:07:17,200 --> 00:07:26,560
Next will do to toggle the amount like the Shell, the show to calculate the amount.

103
00:07:26,860 --> 00:07:33,650
So when this should do so, for that, we need to create another case that will be the total amount.

104
00:07:33,700 --> 00:07:37,150
OK, so action start I.

105
00:07:39,130 --> 00:07:40,930
Is equally critical to.

106
00:07:43,470 --> 00:07:44,070
All girl.

107
00:07:45,390 --> 00:07:45,930
Among.

108
00:07:47,030 --> 00:07:48,410
And this will return.

109
00:07:49,930 --> 00:07:55,120
First of all, we'll create a temporary car ban.

110
00:07:58,700 --> 00:08:03,530
Tim Card is equal to St. Dart.

111
00:08:07,350 --> 00:08:08,130
But map.

112
00:08:10,790 --> 00:08:17,810
No map function expects a function inside that should be welcoming.

113
00:08:18,710 --> 00:08:27,290
So inside this will create a further function and then we'll see that if the cart item, it is equal

114
00:08:27,300 --> 00:08:33,440
equal to the payload I.D. So then we'll see like what we need to do if.

115
00:08:34,720 --> 00:08:36,880
The guard item.

116
00:08:37,830 --> 00:08:38,610
Thought I'd.

117
00:08:41,600 --> 00:08:44,510
Is equally equal to the.

118
00:08:45,770 --> 00:08:52,700
Action Lord, the Lord now, let me explain one thing, if you are so confused, that's why we are using

119
00:08:52,700 --> 00:08:53,990
three tools here.

120
00:08:54,830 --> 00:09:00,000
Remember, in JavaScript, you equal to means it will look.

121
00:09:00,020 --> 00:09:02,750
It will check the value is equal or not.

122
00:09:03,380 --> 00:09:07,010
Like, for example, and that is 10.

123
00:09:07,490 --> 00:09:08,750
Not ten is an integer.

124
00:09:08,960 --> 00:09:21,350
OK, now if there is a string and that is equal to 10, for example, I provide I provide constant constraint

125
00:09:21,350 --> 00:09:22,290
and its values.

126
00:09:22,290 --> 00:09:22,490
10.

127
00:09:22,490 --> 00:09:22,730
OK.

128
00:09:23,660 --> 00:09:24,380
OK, that's 10.

129
00:09:24,980 --> 00:09:28,250
Now I create a string and I pass Ben into it.

130
00:09:28,790 --> 00:09:30,590
Now are these two things equal?

131
00:09:31,370 --> 00:09:35,390
What you will say to endorse script if you if you want to check this.

132
00:09:35,810 --> 00:09:40,280
So if you give the equal to so, it will return true, that means they are equal.

133
00:09:40,880 --> 00:09:41,510
They're equal.

134
00:09:41,810 --> 00:09:49,580
But if you check them with the three equal tools for what another extra equal you sign will do is that

135
00:09:49,580 --> 00:09:52,280
it will check for its data type as well.

136
00:09:52,700 --> 00:09:58,280
Like the two equal tools will just check the value and the three core values will check the data type

137
00:09:58,280 --> 00:09:58,910
as well.

138
00:09:59,480 --> 00:10:06,680
Like, if you know, check that 10 integer 10 is equal to spring 10.

139
00:10:06,920 --> 00:10:10,400
So now it will return false because the data type is not the same.

140
00:10:10,670 --> 00:10:13,640
One is an integer and another one is in string.

141
00:10:14,010 --> 00:10:15,260
So that is what we are doing.

142
00:10:15,440 --> 00:10:19,610
Three equal to means it is checking for the value as well as the data type.

143
00:10:19,820 --> 00:10:24,020
If you if we do like two equal to zero, it will just check for the value.

144
00:10:24,200 --> 00:10:28,730
So this is what is the magic of JavaScript.

145
00:10:31,060 --> 00:10:33,170
Next, we'll move on.

146
00:10:33,190 --> 00:10:40,310
And right now, I was in the total amount and I will I was checking the action like the guard item I.D.

147
00:10:40,340 --> 00:10:45,950
and action or payload I.D. And now inside this in there done something.

148
00:10:46,130 --> 00:10:50,800
If these two are equal to what we'll do is we'll return.

149
00:10:52,760 --> 00:10:56,990
Written and will an object, basically.

150
00:10:57,110 --> 00:11:00,140
So we leave the spirit operator and that will be carved.

151
00:11:02,000 --> 00:11:03,290
But I don't.

152
00:11:05,000 --> 00:11:08,870
And the amount would be God tight.

153
00:11:10,440 --> 00:11:15,700
Dortmund last won in both.

154
00:11:17,820 --> 00:11:18,360
Next.

155
00:11:19,550 --> 00:11:24,110
We'll put it on board like this first for the increasing OK.

156
00:11:24,720 --> 00:11:25,550
Like if?

157
00:11:29,100 --> 00:11:32,010
Well, OK, that should be another if statement here.

158
00:11:32,310 --> 00:11:37,150
Like, when we are checking for this, there should be another statement that will check for the type.

159
00:11:37,170 --> 00:11:38,630
OK, my bad.

160
00:11:38,640 --> 00:11:39,120
I'm sorry.

161
00:11:39,750 --> 00:11:41,070
We'll be right.

162
00:11:43,400 --> 00:11:51,590
If action start, I is equal equal to.

163
00:11:53,490 --> 00:12:00,540
Inc, what does the think this means increase, like if they use a selected to increase the number of

164
00:12:00,540 --> 00:12:03,750
products for this scored will be executed?

165
00:12:04,990 --> 00:12:12,130
They will write the same thing for the decreasing part also after this.

166
00:12:14,080 --> 00:12:17,020
We'll add a code for.

167
00:12:18,430 --> 00:12:23,050
For the increase, and that will be if.

168
00:12:24,520 --> 00:12:28,690
Action Dog II is equally according to.

169
00:12:31,050 --> 00:12:33,180
We just the degrees.

170
00:12:34,960 --> 00:12:42,570
Actually, that will action not, but it is action dot below dot type, because this is the payload

171
00:12:42,630 --> 00:12:44,360
type thing is already over.

172
00:12:44,410 --> 00:12:51,430
So payload, dot type and same goes here, also below dart type.

173
00:12:52,580 --> 00:12:54,020
And if that's equal to.

174
00:12:55,260 --> 00:12:55,650
B.

175
00:12:56,100 --> 00:12:56,390
B.

176
00:12:56,430 --> 00:12:56,850
C.

177
00:12:57,390 --> 00:12:58,140
And now.

178
00:12:59,100 --> 00:13:06,450
So this will provide the court, so basically I'll just copy this code because it's doing the same thing,

179
00:13:06,450 --> 00:13:12,150
and I just I'll just provide the negative value for it.

180
00:13:13,020 --> 00:13:15,450
For example, here it was.

181
00:13:15,450 --> 00:13:18,540
Plus we had a low minus symbol.

182
00:13:19,800 --> 00:13:23,220
Nothing so complex, I like to after this.

183
00:13:25,080 --> 00:13:30,180
There are few more things which we need to do like by default.

184
00:13:30,180 --> 00:13:32,640
We need to return the card statement and all.

185
00:13:32,820 --> 00:13:37,440
So this was ending.

186
00:13:37,440 --> 00:13:47,390
You're not here because in this statement, OK, for this, we knew we forgot to provide the parent

187
00:13:47,420 --> 00:13:47,900
kisses.

188
00:13:48,900 --> 00:13:51,240
And that will be provided here.

189
00:13:52,760 --> 00:13:53,170
OK.

190
00:13:53,570 --> 00:13:54,440
This is not this.

191
00:13:54,770 --> 00:14:01,150
And for this, we'll provide another one after this like this one is this ending parenthesis is for

192
00:14:01,160 --> 00:14:05,140
this and this would be for this would be for this.

193
00:14:05,180 --> 00:14:05,960
This is for this.

194
00:14:06,890 --> 00:14:09,800
And yeah.

195
00:14:10,690 --> 00:14:13,480
Now, I hope that that makes sense.

196
00:14:15,000 --> 00:14:15,960
I hope that makes sense.

197
00:14:15,990 --> 00:14:24,990
OK, next, what we'll do is we'll return some basic general things, so we'll return.

198
00:14:25,640 --> 00:14:28,140
Got it on.

199
00:14:30,860 --> 00:14:33,950
Item, so this is the like default thing, OK?

200
00:14:34,400 --> 00:14:37,460
And now overall, we think that this will be a filter.

201
00:14:37,820 --> 00:14:43,970
OK, let me do it quick because we are giving a lot of time to this one component, so I don't want

202
00:14:43,970 --> 00:14:46,100
to make it so long.

203
00:14:46,550 --> 00:14:48,650
That would be I don't.

204
00:14:51,160 --> 00:14:51,940
It will be.

205
00:14:53,280 --> 00:15:02,550
But you don't even need to provide the columnists for the guard item guide item Dortmund should know

206
00:15:02,550 --> 00:15:04,740
and be equal equal to zero.

207
00:15:06,050 --> 00:15:06,680
And.

208
00:15:07,990 --> 00:15:10,540
Why buy the word prep is not working?

209
00:15:13,570 --> 00:15:13,840
Yeah.

210
00:15:14,760 --> 00:15:19,410
All scored after the filter will return one more time.

211
00:15:20,370 --> 00:15:21,540
I know you.

212
00:15:21,800 --> 00:15:28,440
You must be thinking there are so many returns in this one particular campaign, but trust me, this

213
00:15:28,440 --> 00:15:30,770
is the most beautiful thing of react.

214
00:15:30,780 --> 00:15:36,180
And once you understand and you connect the dots, you will love it.

215
00:15:36,420 --> 00:15:43,560
You will not, will will not think of creating any project without the use it or lose it, because this

216
00:15:43,560 --> 00:15:45,990
is the most important thing to learn.

217
00:15:47,270 --> 00:15:53,390
And after this, we'll just throw error if that is an error, we'll throw through new.

218
00:15:54,680 --> 00:15:55,030
At A.

219
00:15:57,410 --> 00:16:01,340
And that will be no matching action type.

220
00:16:04,240 --> 00:16:04,710
Excellent.

221
00:16:05,920 --> 00:16:12,910
Now this is similar to that in the statement, there is a default statement that the last which implies

222
00:16:12,910 --> 00:16:20,030
that if any one of the cases is not true, like the user is entering something else, only so true that

223
00:16:20,050 --> 00:16:23,180
error, which is that in the default theme through new error.

224
00:16:23,200 --> 00:16:25,600
So this is this is a JavaScript thing.

225
00:16:26,320 --> 00:16:27,760
Okay, let me save.

226
00:16:29,810 --> 00:16:34,880
And see, it's compiling OK, there, we made a typo.

227
00:16:36,310 --> 00:16:40,800
So that is on line 53, 53.

228
00:16:41,350 --> 00:16:45,590
Yeah, OK, for the faults, I provide three three.

229
00:16:45,670 --> 00:16:46,570
Yes, OK.

230
00:16:47,500 --> 00:16:49,390
Things are good now and.

231
00:16:52,180 --> 00:16:54,040
Things are working fine so far.

232
00:16:55,490 --> 00:16:57,860
So we'll check this out.

233
00:16:58,040 --> 00:17:03,920
We'll check the UI in the next video, we'll check how this thing looks on the UI in the browser.
