Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,180 --> 00:00:04,980
In the last lecture, we have simplified to map state function, we have simplified the way have you
2
00:00:04,980 --> 00:00:10,920
are getting that data back in this lecture, I would like to talk about a composition of API.
3
00:00:11,970 --> 00:00:15,600
All right, let's begin and the composition API, what will allow us.
4
00:00:17,000 --> 00:00:22,790
It's called like this, it's a comb for composition.
5
00:00:23,770 --> 00:00:32,050
API, so the composition API, they can create chunks of reusable functionality survive, you expect
6
00:00:32,050 --> 00:00:39,070
something to repeat in your code, you can drop it in the composition API and then you can reuse it
7
00:00:39,070 --> 00:00:40,540
in the multiplayer component.
8
00:00:41,200 --> 00:00:47,160
In our case, composition API will be using IT authentication because are components, multiple components,
9
00:00:47,170 --> 00:00:49,060
they'll be working without authentication.
10
00:00:50,350 --> 00:00:51,660
So that's a pretty good example.
11
00:00:51,670 --> 00:00:55,420
Competition API is still a kind of a new thing in in a view.
12
00:00:56,290 --> 00:00:57,280
So it's a good to now.
13
00:00:58,420 --> 00:00:59,320
Let's initialize it.
14
00:00:59,320 --> 00:01:01,160
It'll be pretty straightforward.
15
00:01:01,200 --> 00:01:05,440
Go to the SASE folder and essentially folder what's called a new folder.
16
00:01:05,890 --> 00:01:09,010
And let's call it composition composition.
17
00:01:09,820 --> 00:01:14,200
In the composition of folder, I will create a new file and it'll create here.
18
00:01:14,800 --> 00:01:18,040
For now example, they'll be working with the register function.
19
00:01:19,520 --> 00:01:20,280
Total free market.
20
00:01:21,520 --> 00:01:25,360
Usually what you are doing with a composition of functions, you are prefixed in them with, they use
21
00:01:25,360 --> 00:01:26,020
keywords.
22
00:01:26,020 --> 00:01:30,640
So if you are use of the React, React is using a similar approach.
23
00:01:30,910 --> 00:01:33,310
OK, so your jazz was inspired by this.
24
00:01:34,510 --> 00:01:40,270
The reactors using their hook functions, they are also prefixed with the use keyboard, and that's
25
00:01:40,300 --> 00:01:41,140
only convention.
26
00:01:41,350 --> 00:01:44,240
You can call, of course, your function as you want, does it?
27
00:01:44,290 --> 00:01:49,770
That's a convention that you know, that you are working with the composition of functions, and we
28
00:01:49,780 --> 00:01:53,770
would like to provide to the composition API register function for now.
29
00:01:53,770 --> 00:01:56,500
So that idea use register dot.
30
00:01:57,460 --> 00:01:58,760
That's a normal JavaScript function.
31
00:01:58,780 --> 00:02:00,340
It's not a view, OK?
32
00:02:02,130 --> 00:02:07,590
In the EU's register, you will export default export default function.
33
00:02:09,810 --> 00:02:11,660
OK, we'll call it the EU's register.
34
00:02:14,130 --> 00:02:15,100
That are like this.
35
00:02:17,110 --> 00:02:22,180
And a lot of the packages that are currently in the villages, they are already supporting the composition
36
00:02:22,180 --> 00:02:22,740
API.
37
00:02:22,750 --> 00:02:25,090
So in this case, what do want to do?
38
00:02:26,280 --> 00:02:32,100
You would like to move the function of the register to the composition API, as you can see here in
39
00:02:32,100 --> 00:02:37,860
the register, I'm using this store to access as this page, but in the composition of function, I
40
00:02:37,860 --> 00:02:41,580
will not have access to this context to this store.
41
00:02:41,970 --> 00:02:47,820
So the way we'll get this story in this way, villagers here use storage function.
42
00:02:48,030 --> 00:02:53,910
It's already provided from the US, so it's very important to use store.
43
00:02:55,570 --> 00:03:00,850
And you can get it from the US, so a lot of the new packages, they are already offering a this composition
44
00:03:00,850 --> 00:03:01,450
API.
45
00:03:02,620 --> 00:03:07,420
OK, maybe they used to, or I can simply ask for my view stories, but I have a store and they use
46
00:03:07,600 --> 00:03:08,080
store.
47
00:03:13,320 --> 00:03:14,460
And they start.
48
00:03:15,520 --> 00:03:20,680
OK, and that I can define here marriages register of functions, so I'll rather simply cons register,
49
00:03:20,680 --> 00:03:22,560
I can define it as the error function.
50
00:03:23,020 --> 00:03:29,280
I can define its error function and retrieve the forum through its parameters, and it will call store
51
00:03:29,320 --> 00:03:39,190
and dispatch and dispatch user select register and will provide a forum data to do exactly the same
52
00:03:39,190 --> 00:03:41,050
as you see here in the register.
53
00:03:42,270 --> 00:03:42,600
OK.
54
00:03:43,800 --> 00:03:46,440
Getting out of form regardless, but you get.
55
00:03:48,140 --> 00:03:52,100
OK, but here I am specifying that I will pass the reform data to the registrar, you will see why.
56
00:03:52,520 --> 00:03:52,910
OK.
57
00:03:54,690 --> 00:03:59,910
So now I can remove the form here because I have only one parameter, so I don't need to repeat.
58
00:04:00,360 --> 00:04:01,830
I don't need to provide a parentheses.
59
00:04:03,450 --> 00:04:08,850
OK, and to the value will provide the data back to your page is the director and.
60
00:04:10,810 --> 00:04:13,440
Right turn, and you will return this back to the page.
61
00:04:15,000 --> 00:04:17,980
OK, I'll write you a diagram, so there'd be easier to understand.
62
00:04:18,660 --> 00:04:19,560
OK, so we have our.
63
00:04:20,730 --> 00:04:21,960
View component, right?
64
00:04:22,120 --> 00:04:24,240
It be you.
65
00:04:25,760 --> 00:04:29,120
Component tests can be a registered page.
66
00:04:29,570 --> 00:04:29,960
All right.
67
00:04:30,260 --> 00:04:34,970
If you'd like to get here, the electric headache here, these the Israelis, their function into the
68
00:04:34,970 --> 00:04:35,870
view component.
69
00:04:36,830 --> 00:04:39,440
OK, so we have then a composition API function.
70
00:04:39,440 --> 00:04:42,850
So we have this use register.
71
00:04:44,330 --> 00:04:51,380
OK, in order to to extract this register function of what we have just defined here to our component.
72
00:04:51,980 --> 00:04:58,400
We need to call here to set up a function, set up function, and we need to call user register in the
73
00:04:58,410 --> 00:04:58,910
set up.
74
00:05:00,350 --> 00:05:02,510
And it will never be returning you to function.
75
00:05:03,420 --> 00:05:05,330
It'll be extracted into our component.
76
00:05:05,930 --> 00:05:06,800
So what was different?
77
00:05:07,690 --> 00:05:11,930
Well, they're very, very obvious registering to call in the set up to get these data to the component.
78
00:05:12,850 --> 00:05:16,220
OK, I think it'll be easier to understand, maybe been able to show you in the code.
79
00:05:17,610 --> 00:05:22,520
So you are returning the register function and now we can go to registered a few.
80
00:05:23,300 --> 00:05:24,950
I can go put together eight of the methods.
81
00:05:25,730 --> 00:05:26,540
I don't need them now.
82
00:05:27,920 --> 00:05:31,880
And instead of these, I've already here set up show up here.
83
00:05:33,350 --> 00:05:35,150
Like this a setup.
84
00:05:35,150 --> 00:05:40,640
I only just simply return here and use a register function, so we need to import this function so important
85
00:05:40,640 --> 00:05:40,970
here.
86
00:05:42,260 --> 00:05:52,070
Use a register from we are going to the output of this folder composition use register and simply be
87
00:05:52,070 --> 00:05:53,690
able to do this.
88
00:05:54,590 --> 00:05:57,140
OK, set up and we are returning here to use the register.
89
00:05:58,820 --> 00:06:06,320
Now, whatever we have returned from his registered charities are Object, which is containing a register.
90
00:06:07,600 --> 00:06:09,610
Which is the function of dispatching that forum.
91
00:06:10,920 --> 00:06:16,170
OK, we can call it but better, we'll call it simply for now, all they can do, we can go up here
92
00:06:16,170 --> 00:06:16,920
into the battle.
93
00:06:17,940 --> 00:06:20,880
And on a click, they are calling her, you start by being too passive their data.
94
00:06:20,910 --> 00:06:26,250
Of course, I will provide as a callback function and call the register of a positive or my forum.
95
00:06:27,990 --> 00:06:30,540
OK, so what I'm calling here.
96
00:06:32,230 --> 00:06:35,350
Is my register a proper use register here?
97
00:06:36,280 --> 00:06:40,930
Let's try it out, so you will see it actually, so let's say it will go back to browsers and you can
98
00:06:40,930 --> 00:06:43,640
also read a debugger as if you want or if you want to see the debugger.
99
00:06:43,640 --> 00:06:45,340
We can just drop it in the curly brackets.
100
00:06:47,010 --> 00:06:49,930
So you see that they are dispatching it indeed all their debugger.
101
00:06:52,300 --> 00:06:53,490
Let's go back to browsers.
102
00:06:55,520 --> 00:06:58,400
OK, and we don't see here anything so we can inspect the error.
103
00:06:59,450 --> 00:07:01,280
Type at or object is a they function.
104
00:07:01,730 --> 00:07:04,800
OK, I think I was importing broccoli the function.
105
00:07:05,570 --> 00:07:09,800
Get back to your registered to view and scroll up into the imports you see here.
106
00:07:09,800 --> 00:07:15,050
And I think her curly brackets register, but they've all got to use register your export they get by
107
00:07:15,050 --> 00:07:21,160
default, which means this is not a not a name export, but is the default export.
108
00:07:21,170 --> 00:07:23,750
And then you have a default export.
109
00:07:24,020 --> 00:07:28,490
You are not specifying curly brackets you can just import straight away to the register.
110
00:07:29,570 --> 00:07:30,650
OK, so that was the issue.
111
00:07:32,070 --> 00:07:33,080
And now we can save it.
112
00:07:33,410 --> 00:07:38,390
They can go back and out of the box and I will sign up the processing and we are done.
113
00:07:38,600 --> 00:07:40,190
And in this case, I should see it over here.
114
00:07:40,400 --> 00:07:40,700
Yeah.
115
00:07:41,920 --> 00:07:47,530
OK, I'm in my console, so remember the back of your head, let's sign up and we get to get a debugger.
116
00:07:47,530 --> 00:07:49,300
You can see the register.
117
00:07:50,270 --> 00:07:53,120
From the youth register is execu that we are passing here.
118
00:07:53,210 --> 00:07:58,790
Forum Considere Forum is email is their name, password and password confirmation, which are empty
119
00:07:58,790 --> 00:08:01,100
strings and that they are dispatching to the store.
120
00:08:02,060 --> 00:08:03,710
And that's basically how it works.
121
00:08:06,680 --> 00:08:12,950
OK, so back to here we can, the reality is we don't need here any debugging Arabica to be a nice one
122
00:08:12,950 --> 00:08:14,990
liner and now you know how the competition is working.
123
00:08:15,470 --> 00:08:16,880
Maybe it's still not clear here.
124
00:08:16,910 --> 00:08:20,360
Here are how we are getting these register function here.
125
00:08:21,230 --> 00:08:26,390
If it's still not clear what you can do, you can just simply extract this so you can grab your Const
126
00:08:28,030 --> 00:08:29,630
Konst register.
127
00:08:30,530 --> 00:08:30,850
OK.
128
00:08:31,070 --> 00:08:32,640
But you are getting from a user registered.
129
00:08:32,640 --> 00:08:34,560
This is actually like this.
130
00:08:34,580 --> 00:08:39,020
The is texturizing register and these are returning here.
131
00:08:39,250 --> 00:08:40,850
I'll check with the register.
132
00:08:41,840 --> 00:08:42,260
OK.
133
00:08:42,470 --> 00:08:48,470
So if it's more explicitly to you now that user register returns, you and you'll take a look this object
134
00:08:48,470 --> 00:08:53,870
to the register that would have this texturizing here, and I'm returning it to the page.
135
00:08:54,380 --> 00:08:58,340
So that's why we can access register function of up here.
136
00:08:58,960 --> 00:09:05,000
We are passing the form data into it, which is in the Entities Register function, which specifies
137
00:09:05,000 --> 00:09:05,600
for data.
138
00:09:05,660 --> 00:09:07,070
We are dispatching this action.
139
00:09:09,530 --> 00:09:13,250
Let's try it out this way, as they specified in a step function.
140
00:09:14,460 --> 00:09:15,810
Good, save it, we can go back.
141
00:09:15,960 --> 00:09:20,730
Let's refresh, let's side up and you can see everything is working as before getting error.
142
00:09:21,490 --> 00:09:25,620
So I don't like this that they are repeating here, which are set to return.
143
00:09:25,620 --> 00:09:26,880
Here you register, and that's it.
144
00:09:28,920 --> 00:09:33,830
Alka-Seltzer composition API register functionality is not a great example, because it is that affects
145
00:09:33,830 --> 00:09:37,860
a lot of you'll be using only in the register, I would need something more usable.
146
00:09:37,860 --> 00:09:43,440
I can use also in other pages and I'll show examples of this in the next lectures.
147
00:09:43,740 --> 00:09:44,160
So guys.
148
00:09:44,550 --> 00:09:46,430
Any questions related to this?
149
00:09:46,680 --> 00:09:49,170
Don't worry, feel free to ask in the Q&A section.
150
00:09:49,170 --> 00:09:51,690
I will be more than happy to provide your detailed explanations.
151
00:09:52,380 --> 00:09:53,480
Let's go to the next lecture.
152
00:09:53,490 --> 00:09:54,210
I will see you there.
14338
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.