1 00:00:00,150 --> 00:00:05,070 Now we are going to demonstrate a use of use contrast and use. 2 00:00:05,070 --> 00:00:12,930 We'll do that together such that in every component you can do use to stage and dispatch an assembly 3 00:00:12,960 --> 00:00:20,640 so you can control the content of some every components and share the Sam's state. 4 00:00:20,640 --> 00:00:22,270 So back to the EP J. 5 00:00:22,380 --> 00:00:25,560 We aren't going to use the use we do with her. 6 00:00:25,860 --> 00:00:27,390 So we are going to import 7 00:00:30,140 --> 00:00:35,780 the use we would her from we add and then we do not need the content. 8 00:00:35,780 --> 00:00:43,620 Instead we are going to use another component so we can delete this one and also delete the Contra. 9 00:00:44,120 --> 00:00:52,290 And now we are going to copy the initial stay and we do with her from the contra so go to the counter 10 00:00:52,650 --> 00:01:02,820 and we copy and then paste inside the f j s and inside the app we are going to create a constant and 11 00:01:04,320 --> 00:01:13,770 we get the stage and dispatch from the use we do that and we path the we do with her and initials day 12 00:01:14,700 --> 00:01:15,320 to day use. 13 00:01:15,390 --> 00:01:25,010 We do so now we go to the component folders we are going to create a computer and a lot the s 14 00:01:28,530 --> 00:01:36,710 so we create a arrow Functional Component and since we are going to use a bootstrap order we have strep 15 00:01:37,480 --> 00:01:43,640 we copy this or import and paste it inside the component 8 and then we save. 16 00:01:43,650 --> 00:01:47,900 And back to the AB J as and now we can import the component a 17 00:01:51,780 --> 00:01:53,370 form the component folder 18 00:02:02,840 --> 00:02:09,020 and then we are going to create a contest such and such that we can pass the initial state and then 19 00:02:09,020 --> 00:02:17,380 we are going to create a contest such that we can pass the state and also the dispatch to the components. 20 00:02:17,510 --> 00:02:29,510 So we are going to edit here and we export a cornerstone the contest equal we at top create contest 21 00:02:30,060 --> 00:02:36,920 if you will remember if we want to pass the contact contest we have to add the provider and then we 22 00:02:37,010 --> 00:02:47,170 are going to pass the where you and the first one is the con where Leo and the other e d d patch which 23 00:02:47,170 --> 00:02:56,560 is this one actually you can also pass it using another name but since we are going to pass the same 24 00:02:56,560 --> 00:03:05,560 name and for the simplicity we can it is one and just leave the dispatch here it is actually the same 25 00:03:05,590 --> 00:03:14,350 as its patch semicolon dispatch now we can go to the component a and we are going to import the contest 26 00:03:16,480 --> 00:03:24,580 from the EP so you're to use the contact contest we are going to add the cornerstone and counter contest 27 00:03:26,590 --> 00:03:34,300 which is equal to use contest and contact contest but we have an import the youth contest so we have 28 00:03:34,300 --> 00:03:35,560 to import from here 29 00:03:40,970 --> 00:03:46,900 so we can console law the kind of contest to see what inside the contact contest. 30 00:03:47,420 --> 00:03:49,400 So if we take a look on this object. 31 00:03:49,420 --> 00:03:52,010 Actually there are two properties. 32 00:03:52,040 --> 00:03:53,050 One is contour. 33 00:03:53,180 --> 00:04:04,460 And one is dispatch so we can use the AP constructor ring to get these two values. 34 00:04:04,470 --> 00:04:06,270 Now we can go to the contour. 35 00:04:06,270 --> 00:04:13,200 Actually this file will be deleted but since some copy still you are going to use we have to copy from 36 00:04:13,200 --> 00:04:14,210 here. 37 00:04:14,730 --> 00:04:16,680 So we copy it is not in groups 38 00:04:24,430 --> 00:04:25,440 and replace it here. 39 00:04:25,450 --> 00:04:27,870 And you already see there is no dispatch. 40 00:04:28,690 --> 00:04:34,210 So we have to change the name from this patch one to this patch only. 41 00:04:34,930 --> 00:04:43,630 And actually we do not need the other button groups and we just need one contour here and we can say 42 00:04:43,630 --> 00:04:46,420 this is a component a condo counter 43 00:04:53,460 --> 00:05:00,430 and you already see there's no state one here because the value already can be get from the contact 44 00:05:07,190 --> 00:05:10,860 as you can see the contralto is stored inside the content. 45 00:05:11,180 --> 00:05:15,830 And now you can also add the radicals and also decrease the radio. 46 00:05:15,920 --> 00:05:17,850 And also we said the value. 47 00:05:17,900 --> 00:05:33,450 We can also compare we've to contact inside the app J as we can also add the Canto value here. 48 00:05:33,470 --> 00:05:36,510 Now we back to our website you'll see the empty contact. 49 00:05:36,530 --> 00:05:42,230 And I can put an a counter where we passed a button inside the computer an A. 50 00:05:42,440 --> 00:05:47,810 Both of them can be controlled by these buttons. 51 00:05:47,810 --> 00:05:52,520 So this is how to use the use we do sir and use contest together.