Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,150 --> 00:00:00,660
Excellent.
2
00:00:00,690 --> 00:00:04,600
And up next in the story, we have the forms.
3
00:00:05,250 --> 00:00:13,110
More specifically, we're going to cover controlled inputs, what they are and how they work and also
4
00:00:13,110 --> 00:00:18,740
how we can set up multiple inputs with just one function.
5
00:00:19,230 --> 00:00:25,710
And before we cover any of those topics, though, I would just want to give you general info about
6
00:00:25,710 --> 00:00:28,610
the how these forms work and react.
7
00:00:28,890 --> 00:00:35,010
So we'll start working in controlled inputs, but we'll cover them in a NextRadio in the beginning.
8
00:00:35,010 --> 00:00:40,860
I would just want to give you the general overview on the file, of course, that we're looking for
9
00:00:40,890 --> 00:00:42,050
years ago.
10
00:00:42,050 --> 00:00:48,570
Again, I'll call the set up just so I don't have to change stuff around in here and say tutorial.
11
00:00:48,810 --> 00:00:52,310
Then we're looking for the folder number for forms, one set up.
12
00:00:52,680 --> 00:00:55,590
And of course, we're looking for controlled inputs.
13
00:00:55,590 --> 00:01:00,750
And now instead of deciding to, I'll render my setup Nerdist.
14
00:01:00,870 --> 00:01:03,930
And if you work with forms in jouster.
15
00:01:04,790 --> 00:01:11,630
You know, that it worked something along the lines of setting up some kind of idea or class or whatever
16
00:01:11,930 --> 00:01:15,500
on the input van, you targeted the input.
17
00:01:15,740 --> 00:01:21,290
And then in order to get the value, you are looking for the value of property on the node.
18
00:01:21,650 --> 00:01:27,960
Now, in Iraq, it's a little bit different where you have those controlled and uncontrolled inputs.
19
00:01:28,250 --> 00:01:33,440
By the way, we'll talk about uncontrolled inputs when we talk about use RF.
20
00:01:33,860 --> 00:01:41,560
But whenever we deal with controlled inputs, you you'll be hooking up your input to a state value.
21
00:01:41,930 --> 00:01:47,150
And since it's going to be easier for me to show, of course, let's just put this one on.
22
00:01:47,150 --> 00:01:53,500
I just remember that the setup is going to be a bit different than a regular JavaScript.
23
00:01:53,900 --> 00:01:55,400
So what I would want to do first.
24
00:01:56,430 --> 00:02:04,590
Well, I think we could change our just a little bit where we'll start with article, by the way, there's
25
00:02:04,590 --> 00:02:05,670
going to be two articles.
26
00:02:06,030 --> 00:02:11,030
One is going to be displaying the items and the second one will be dealing with four.
27
00:02:11,110 --> 00:02:15,830
So let's just start with the form and the next video will add those items as well.
28
00:02:16,410 --> 00:02:20,820
And when it comes to a form, we're not going to deal with action.
29
00:02:21,630 --> 00:02:23,500
So we'll deal with that on our end.
30
00:02:23,780 --> 00:02:31,860
Now, I do want to add here a class and I'm just for styling purposes, and that is going to be a form
31
00:02:32,370 --> 00:02:34,590
an inside of the form.
32
00:02:35,230 --> 00:02:39,150
Set up, I think, to input's is going to be geared.
33
00:02:39,660 --> 00:02:42,260
So we'll go with form control again.
34
00:02:42,270 --> 00:02:43,450
This is just for styling.
35
00:02:43,920 --> 00:02:45,140
Please keep that in mind.
36
00:02:45,540 --> 00:02:49,820
And once I shave, I should have the form on the screen.
37
00:02:49,830 --> 00:02:52,980
Beautiful homeland within this form control again.
38
00:02:53,270 --> 00:02:54,520
This is just for styling.
39
00:02:54,540 --> 00:02:55,530
Please keep that in mind.
40
00:02:55,540 --> 00:02:58,800
It has nothing to do with the react within this div.
41
00:02:59,100 --> 00:03:04,860
Now I would want to set up my input, but I also want to set up a label because I would want to showcase
42
00:03:04,860 --> 00:03:08,570
how we can connect label with input and react.
43
00:03:08,970 --> 00:03:16,110
And as far as the react, because the naming conventions and joysticks are calling for Kamakshi, you'll
44
00:03:16,110 --> 00:03:17,460
see the syntax where.
45
00:03:18,380 --> 00:03:23,600
In regular schedule, of course, you wouldn't write that like this, but in react, if you have a label
46
00:03:23,600 --> 00:03:31,370
and you want to connect it to the input that we're about to set up, you need to use this HMO for written
47
00:03:31,370 --> 00:03:32,380
in chemicals.
48
00:03:32,660 --> 00:03:38,060
And here you need to pass in of the ID that is eventually going to be on the input.
49
00:03:38,270 --> 00:03:39,940
So in my case, it's going to be first name.
50
00:03:39,950 --> 00:03:47,150
That's I'm it right here and all right here, name, line, colon like so.
51
00:03:47,340 --> 00:03:49,540
And of course, we would need to set up our input.
52
00:03:49,880 --> 00:03:55,760
So I'm going to go with input now, type the same works as with regular HMO.
53
00:03:56,030 --> 00:03:57,450
So we have multiple types.
54
00:03:57,470 --> 00:04:01,670
In this case, I'm going to go with my basic one, which is going to be a text.
55
00:04:01,970 --> 00:04:05,270
And of course, I would need to have two things.
56
00:04:05,690 --> 00:04:10,300
I would need to have the idea as well as the name.
57
00:04:11,120 --> 00:04:18,290
So we're going to go here with an ID and also the sequel to a first name, just like I had in the label.
58
00:04:18,470 --> 00:04:21,080
And then let's also set up the name.
59
00:04:21,390 --> 00:04:22,700
So say your name.
60
00:04:22,970 --> 00:04:27,640
And that is equal to a first online name.
61
00:04:28,190 --> 00:04:30,060
So Sayeret Emeritus.
62
00:04:30,350 --> 00:04:32,270
And of course I have my label.
63
00:04:32,450 --> 00:04:39,290
Not once I click on a label, I write away, highlight my input and of course I have the input.
64
00:04:39,740 --> 00:04:44,240
And since I would want to have two of them, I'll copy and paste.
65
00:04:44,450 --> 00:04:50,340
And we just need to change some values around where one control stays exactly the same.
66
00:04:50,630 --> 00:04:52,730
Now it is going to be a bit different.
67
00:04:53,070 --> 00:04:54,530
So let me select both of them.
68
00:04:54,890 --> 00:05:01,750
And we're looking for email and also the name will change.
69
00:05:02,240 --> 00:05:04,670
So let's right over here email.
70
00:05:04,850 --> 00:05:08,660
And by the way, in here, I also would need to change it to email.
71
00:05:08,930 --> 00:05:14,390
And once I have my second input, I also would want to set up right away a button.
72
00:05:14,810 --> 00:05:21,260
So I'm going to go here with Button, then type will be met on.
73
00:05:21,360 --> 00:05:27,350
And here let's just write and person and you'll see why we do that in NextRadio.
74
00:05:27,650 --> 00:05:29,840
So we have our button on some.
75
00:05:30,080 --> 00:05:33,680
And then when it comes to react, we have two options.
76
00:05:34,160 --> 00:05:42,650
Either we can add on, submit on the form so the form element or we can still add on.
77
00:05:42,650 --> 00:05:47,000
Click on this button and I'll show you in a second.
78
00:05:47,720 --> 00:05:49,010
Both of them will work.
79
00:05:49,070 --> 00:05:52,670
But let's start with EntreMed because that is something we haven't covered.
80
00:05:52,940 --> 00:06:01,270
So on the form we can set up on Subnet Lessner and then of course we'll still need our handle and then
81
00:06:02,510 --> 00:06:03,740
met like so.
82
00:06:04,100 --> 00:06:11,120
And of course we would want to come up with that function online handle so met.
83
00:06:11,360 --> 00:06:15,820
Now eventually there's going to be an event object and I'll show you why.
84
00:06:15,830 --> 00:06:22,400
And second, for time being, let's just go with our world and let's see what is happening.
85
00:06:22,850 --> 00:06:26,120
So I type my values, both of them like Shell.
86
00:06:26,450 --> 00:06:34,940
And now once I press the button or I press return, I should I should see how the world and the console,
87
00:06:35,300 --> 00:06:37,490
how it's not happening.
88
00:06:37,670 --> 00:06:38,020
Why?
89
00:06:38,040 --> 00:06:43,370
Well, because by default, browser will try to submit the form and then refresh the page.
90
00:06:43,520 --> 00:06:45,500
That's why we don't see this whole world.
91
00:06:45,740 --> 00:06:49,940
And just like in JavaScript, we have access to the event object.
92
00:06:50,210 --> 00:06:54,860
And on that event object, we have a method called prevent default.
93
00:06:55,310 --> 00:06:58,430
We're essentially we're saying, you know what, prevent the default behavior.
94
00:06:58,700 --> 00:07:02,570
We will deal with this form data on our own.
95
00:07:02,570 --> 00:07:09,620
And so the way would prevent the default would be falling way where we go would prevent default.
96
00:07:09,880 --> 00:07:16,520
Now, of course, once we fill it out, either we can press enter or we can press on the button and
97
00:07:16,540 --> 00:07:19,730
of course, will be able to see the whole world.
98
00:07:20,000 --> 00:07:25,630
So essentially now we're not a refreshing the page the moment we submit the form.
99
00:07:25,820 --> 00:07:26,270
Awesome.
100
00:07:26,660 --> 00:07:33,650
And just to showcase that, it will still work if we set this up on the button with a type of event.
101
00:07:34,010 --> 00:07:35,870
Let's go here with on Click.
102
00:07:36,320 --> 00:07:44,310
And it's the same deal when we pass and I submit now remove it for a second, even though we'll push
103
00:07:44,330 --> 00:07:44,780
it back.
104
00:07:45,320 --> 00:07:48,410
And here again, let's try it out and check it out.
105
00:07:48,590 --> 00:07:49,580
It will still work.
106
00:07:49,580 --> 00:07:56,840
So again, that is the case where you have multiple options of how you would want to submit the form
107
00:07:57,170 --> 00:07:58,440
in direct.
108
00:07:58,460 --> 00:08:05,570
Either you use this on submit, but make sure you press the button form or you can still use the good
109
00:08:05,570 --> 00:08:06,470
old one click.
110
00:08:06,860 --> 00:08:14,510
Make sure that the button is type submit and then of course, make sure that you in both scenarios as
111
00:08:14,510 --> 00:08:17,060
a parameter in this function you are.
112
00:08:17,360 --> 00:08:25,030
Accessing the event object and then however you want to call this spammer and my I call this E online,
113
00:08:25,040 --> 00:08:30,920
you can look for the properties that are available on that event object.
114
00:08:31,140 --> 00:08:33,680
So our move this on click.
115
00:08:34,110 --> 00:08:38,780
So that would be a basic setup when it comes to forms in react.
10888
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.