1 00:00:00,360 --> 00:00:00,780 Beautiful. 2 00:00:01,120 --> 00:00:07,590 Up next, we have increased the amount of items in the car, so I have my items, each of them have 3 00:00:07,590 --> 00:00:14,100 the amount, and then once I click on a button, I would want to increase that amount in the car. 4 00:00:14,580 --> 00:00:20,910 Now, at the moment, we'll just the amount and then eventually, of course, we will set up our global 5 00:00:20,910 --> 00:00:27,090 amount as far as how many items we have in the car and then the totals at the moment, we'll just deal 6 00:00:27,330 --> 00:00:32,350 with the single amounts for each of the items we have in the car. 7 00:00:32,820 --> 00:00:36,570 There's always the spiel is the same context is the first one. 8 00:00:36,840 --> 00:00:42,300 And we go with CONSED and then I'll call this increase because I think it's is just going to be faster. 9 00:00:42,450 --> 00:00:44,380 Again, we are looking forward. 10 00:00:44,760 --> 00:00:45,960 Yeah, that is the same. 11 00:00:46,230 --> 00:00:52,080 So we go with this patch here, we pass in the object and then I would want to go type and I'm going 12 00:00:52,080 --> 00:00:59,190 to say increase now same thing we pass in the payload and that one is equal to Marty and you know, 13 00:00:59,310 --> 00:01:02,150 just so we can speed up the process. 14 00:01:02,340 --> 00:01:05,160 But I'll also pass in the pictures now. 15 00:01:05,160 --> 00:01:12,210 I won't set up the functionality for both of them in the register, but since the setup is pretty much 16 00:01:12,210 --> 00:01:17,430 the same, we have increase and decrease and the only thing that is changing is the type. 17 00:01:18,460 --> 00:01:20,110 I say here, decrease. 18 00:01:21,090 --> 00:01:24,310 Decrease in line, I would want to pass both of them down. 19 00:01:24,670 --> 00:01:29,710 No, that's not what I wanted to do, let's say increase and decrease. 20 00:01:29,970 --> 00:01:36,080 And now the structure, both of them in the item we have removed already and then we're going to go 21 00:01:36,080 --> 00:01:38,630 with increase and decrease. 22 00:01:38,940 --> 00:01:40,660 Let's save online. 23 00:01:40,710 --> 00:01:46,470 What we're looking for is, of course, the on click, the moment we have to console logs where we have 24 00:01:46,470 --> 00:01:53,190 the same thing removed, because if the first one is the increase and the second one will be decrease, 25 00:01:53,520 --> 00:01:59,010 we increase, we pass in the area and the same thing will be decrease amount. 26 00:01:59,460 --> 00:02:02,610 If you're lost a little bit, just look for the comments. 27 00:02:03,060 --> 00:02:07,980 For the decrease, of course, have decreased amount and then for the increase, I have increased amount 28 00:02:08,520 --> 00:02:11,730 and here we go, decrease and then again we pass in the area. 29 00:02:12,090 --> 00:02:16,230 And of course, we will just need to handle that in the Rudisha. 30 00:02:16,980 --> 00:02:19,800 So we go back over here, we have action type. 31 00:02:20,010 --> 00:02:23,200 And then, of course, in this case, the action type is increased. 32 00:02:23,280 --> 00:02:28,470 So we go with action and type is equal to increase. 33 00:02:28,950 --> 00:02:36,030 And in this case, I will set up the separate variable because I think it's just going to be easier 34 00:02:36,240 --> 00:02:37,230 to follow along. 35 00:02:37,500 --> 00:02:42,630 So I'm going to go with let and then cart and for the time being is just going to be an empty array, 36 00:02:42,930 --> 00:02:47,460 because first I would want to set up my return and I'll say, yep, I would want to return to state. 37 00:02:47,760 --> 00:02:50,660 I don't want to change as far as other properties. 38 00:02:50,940 --> 00:02:56,680 So of course we'll copy them and then I'll say the card value will be equal to my time card. 39 00:02:56,940 --> 00:03:02,040 And of course at the moment it is an empty array, but we'll change that and a split second. 40 00:03:02,310 --> 00:03:04,650 So we go with state, not as my own state. 41 00:03:04,650 --> 00:03:05,640 I'm looking for the card. 42 00:03:05,850 --> 00:03:09,270 And again, I would want to call in the map method. 43 00:03:09,480 --> 00:03:14,670 So I would want iterate over the card that is before or the update. 44 00:03:14,970 --> 00:03:19,410 And then here again, I'll call this card item that is going to be each item in the card. 45 00:03:19,740 --> 00:03:21,960 And as I'm iterating over it. 46 00:03:22,850 --> 00:03:30,080 What I would want is check if the item matches the idea that I'm passing and then, of course, I would 47 00:03:30,080 --> 00:03:34,010 want to increase that amount properly in that item. 48 00:03:34,280 --> 00:03:41,930 So here we say, if correct item, then it matches to the payload that I'm passing in that beautiful. 49 00:03:42,350 --> 00:03:44,260 But I would want to change that item. 50 00:03:44,420 --> 00:03:46,970 If not, then I simply want to return. 51 00:03:47,390 --> 00:03:50,240 So I just return the cart item the way it is. 52 00:03:50,570 --> 00:03:52,120 So I'm ordering over. 53 00:03:52,460 --> 00:03:56,240 Each item is represented by the item and then I have my condition. 54 00:03:56,240 --> 00:04:04,070 Whereas if Kameda matches the payload that I'm passing and awesome that increase that amount by one. 55 00:04:04,490 --> 00:04:07,060 If not, then return the item from here. 56 00:04:07,070 --> 00:04:13,400 Of course I just need to come up with my return where I'm going to say if that is the case, if the 57 00:04:13,400 --> 00:04:16,220 ID matches, then I would want to return a new object. 58 00:04:16,490 --> 00:04:21,320 I'll copy other properties from the car item because I don't want to change them. 59 00:04:21,550 --> 00:04:24,440 However, the amount is the one that I would want to change. 60 00:04:24,860 --> 00:04:29,210 So in here I'm going to say, yeah, there's going to be new value for the amount property and that 61 00:04:29,210 --> 00:04:35,420 one will be cart item, that current amount and then plus one the reason why we have plus one because 62 00:04:35,420 --> 00:04:38,120 of course we're increasing by one down here. 63 00:04:38,120 --> 00:04:39,760 I had a tiny bag. 64 00:04:39,770 --> 00:04:41,120 It should be action. 65 00:04:41,270 --> 00:04:48,230 And then that payload, which you should notice is that once you click, we're increasing again. 66 00:04:48,650 --> 00:04:50,990 It's not reflected in number or in total. 67 00:04:51,290 --> 00:04:53,930 Don't worry, we're going to get that for now. 68 00:04:54,170 --> 00:04:59,000 I just want to be able to increase this month, which, of course, I can do that. 69 00:04:59,160 --> 00:05:00,350 Beautiful ones. 70 00:05:00,350 --> 00:05:04,620 We have this one in place and of course, we'll start dealing with vigorish.