Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,520 --> 00:00:01,720
Hey, it's Andre here.
2
00:00:01,750 --> 00:00:08,470
I just wanted to spend a quick moment looking at what create react that gives us now the first thing
3
00:00:08,470 --> 00:00:14,290
we saw in the previous video is that we have this package that Jason file, and we also saw that we
4
00:00:14,290 --> 00:00:16,430
had these commands available to us.
5
00:00:17,110 --> 00:00:23,320
Now, if I open up the terminal here in my visual studio code, make sure that we're inside of our project.
6
00:00:23,330 --> 00:00:26,860
In my case, I will code into the test folder.
7
00:00:28,150 --> 00:00:33,070
And for some of you, maybe when you ran yard start, nothing happened.
8
00:00:33,910 --> 00:00:38,100
And that's because you may not have a yarn installed on your computer.
9
00:00:38,410 --> 00:00:40,030
Instead, you might have NPM.
10
00:00:40,540 --> 00:00:42,070
So if you do npm start.
11
00:00:43,200 --> 00:00:45,240
This should now work.
12
00:00:46,550 --> 00:00:54,440
Now, for those that don't know, NPM is a package manager, it's essentially a way for us to automate
13
00:00:54,440 --> 00:01:01,850
the process of installing, upgrading, configuring or removing any libraries that we want.
14
00:01:02,090 --> 00:01:07,110
For example, installing react which create react app did automatically for us.
15
00:01:08,000 --> 00:01:12,680
Now, there's also this other package manager called Yade.
16
00:01:13,490 --> 00:01:15,590
You can use whichever one you want.
17
00:01:15,620 --> 00:01:18,790
The only difference is the commands that you put into your terminal.
18
00:01:18,800 --> 00:01:22,160
So it could be npm start or you can start.
19
00:01:22,910 --> 00:01:28,310
Yarn was actually created by Facebook at a time where AMPM had a few issues.
20
00:01:29,430 --> 00:01:31,710
So this is just up to you, whichever one you choose.
21
00:01:32,700 --> 00:01:38,520
Now, one thing you notice here is that I've successfully start my app, but it didn't show up on my
22
00:01:38,520 --> 00:01:39,010
browser.
23
00:01:39,060 --> 00:01:40,190
Sometimes that could happen.
24
00:01:40,200 --> 00:01:45,840
So all you have to do in that case is just go to localhost three thousand and you'll see that your app
25
00:01:45,840 --> 00:01:46,560
is now here.
26
00:01:46,840 --> 00:01:47,760
Everything is working.
27
00:01:49,720 --> 00:01:53,650
Now, the other thing I want to talk about is this NPM run, build.
28
00:01:54,730 --> 00:01:56,380
If I close this application.
29
00:01:57,580 --> 00:02:03,550
Again, I can use either AMPM or Yade, but if I do ampm run, build.
30
00:02:05,490 --> 00:02:12,750
I want you to notice what's going to happen over here, as you said, we have the source folder where
31
00:02:12,750 --> 00:02:17,080
we have all our files, and you can think of this as our workspace.
32
00:02:17,130 --> 00:02:19,950
This is our workbench where we're going to work on our application.
33
00:02:20,550 --> 00:02:28,410
But when we actually put it to the outside world, when we actually deploy our application, if we give
34
00:02:28,410 --> 00:02:35,100
all these files to the browser, the browser is going to be like, I have no idea what are trying to
35
00:02:35,100 --> 00:02:35,310
do.
36
00:02:35,700 --> 00:02:38,690
I have no idea what this syntax is.
37
00:02:39,060 --> 00:02:40,550
Yeah, I'm going to pass.
38
00:02:40,560 --> 00:02:41,130
I have no idea.
39
00:02:41,130 --> 00:02:44,820
And it's going to erupt instead by running NPM run, build.
40
00:02:44,820 --> 00:02:47,400
I want you to notice what's going to happen to the public folder.
41
00:02:50,240 --> 00:02:56,030
You see here that says it's creating an optimized production built one of the beauty things of create
42
00:02:56,050 --> 00:02:59,600
reactor is that it optimizes the code for you.
43
00:02:59,990 --> 00:03:00,830
Let me show you what I mean.
44
00:03:02,740 --> 00:03:06,160
You see here that we now have a build folder.
45
00:03:07,090 --> 00:03:13,840
If I click on this build folder, you see that I have all my files in here that well, some of them
46
00:03:13,840 --> 00:03:15,910
I've seen before like the fabric on.
47
00:03:17,190 --> 00:03:25,920
Our index dot e-mail file, but you see, this has been minified, so it's going to take less data that
48
00:03:25,920 --> 00:03:27,900
we can send from our server.
49
00:03:28,200 --> 00:03:33,810
If we go to the static, we see that we have our access files, which again, have been minified.
50
00:03:34,080 --> 00:03:40,620
We have our JavaScript files, which over here it looks like we have a bunch of them, all of them minified.
51
00:03:40,620 --> 00:03:41,970
It kind of looks like gibberish.
52
00:03:42,300 --> 00:03:47,790
But inside here we have all the code that we wrote.
53
00:03:48,670 --> 00:03:55,780
In our source folder, and it went through this step to create optimized, built files for us.
54
00:03:56,170 --> 00:04:01,480
So what we want to do now is take this built folder and put it on a server.
55
00:04:02,600 --> 00:04:08,570
Now, we're going to go over deployment later on in the course, but I want to go back to the power
56
00:04:08,570 --> 00:04:09,650
of reactor.
57
00:04:10,870 --> 00:04:16,029
You see, it uses -- and Bable, something we'll talk about later on in the course.
58
00:04:17,660 --> 00:04:25,910
Now, Bable and Watpac allow us to take our source folder, which I mean, we had a lot of JavaScript
59
00:04:25,910 --> 00:04:28,270
files and we're going to write a lot more throughout the course.
60
00:04:28,850 --> 00:04:35,270
What they're going to do is they're going to take these files and Bable is going to do this thing first.
61
00:04:35,480 --> 00:04:40,730
Babo is going to say, hey, all these JavaScript files with that weird react syntax that we're not
62
00:04:40,730 --> 00:04:42,810
really too sure what's what's going on.
63
00:04:43,520 --> 00:04:50,600
Well, I'm going to take all those files for you and remember how traditionally we had all these browsers
64
00:04:51,500 --> 00:04:55,010
that, well, implemented the browser differently.
65
00:04:55,760 --> 00:05:01,460
Bable is going to make sure that our JavaScript files are going to work on all these browsers no matter
66
00:05:01,460 --> 00:05:05,060
what version, no matter how old they are, how new they are.
67
00:05:05,180 --> 00:05:10,490
They're going to make sure for us that, hey, every single one of these JavaScript files is going to
68
00:05:10,490 --> 00:05:11,120
be understood.
69
00:05:11,360 --> 00:05:16,970
So it's kind of like Jaquie did back in the day when we had this idea of making sure that the browsers
70
00:05:16,970 --> 00:05:17,720
understand us.
71
00:05:17,930 --> 00:05:18,380
Awesome.
72
00:05:20,280 --> 00:05:21,270
But what about weapons?
73
00:05:21,510 --> 00:05:27,590
Well, Watpac is a module bundler, it's letting us right to modular code.
74
00:05:28,440 --> 00:05:29,280
So what does that mean?
75
00:05:30,700 --> 00:05:36,160
This built folder, you'll see that we have a lot of JavaScript files in our source folder, but the
76
00:05:36,160 --> 00:05:40,170
build folder actually has, well, just a few JavaScript files.
77
00:05:40,810 --> 00:05:42,250
It has the main.
78
00:05:43,750 --> 00:05:48,970
JavaScript file, see that we only have actually three JavaScript files.
79
00:05:50,250 --> 00:05:56,910
And that's because -- is going to take all our JavaScript, remember all these imports that we're
80
00:05:56,910 --> 00:06:03,070
doing and create, well, bundle everything up together and optimized for production.
81
00:06:03,900 --> 00:06:10,770
Now, you don't need to understand this whole process because the beauty is that REACT has a dedicated
82
00:06:10,770 --> 00:06:17,250
team of developers, really, really smart developers that implements this behind the scenes for you.
83
00:06:17,610 --> 00:06:20,520
That's the power of a tool like create racked up.
84
00:06:20,520 --> 00:06:23,100
It's a Seelie or command line interface.
85
00:06:23,220 --> 00:06:29,580
Other frameworks like Angular or View have the same thing, a way for us to start a project really,
86
00:06:29,580 --> 00:06:30,200
really fast.
87
00:06:30,360 --> 00:06:37,530
Have all this configuration done for us, optimized for us, so that we can build really nice performant
88
00:06:37,530 --> 00:06:38,250
applications.
89
00:06:39,060 --> 00:06:46,560
So remember, this built folder is what we'll use to actually deploy our application.
90
00:06:47,040 --> 00:06:51,450
This source folder is our playground, our workplace.
91
00:06:53,650 --> 00:07:00,100
Now, let's go back to Pakistan, Jason, when we look at Pakistan, Jason, the reason we have this
92
00:07:00,610 --> 00:07:07,840
is that it allows us to have this package manager so that remember how he said react is all about this
93
00:07:07,840 --> 00:07:12,420
component architecture and we can use other people's code and other components.
94
00:07:12,430 --> 00:07:18,560
Well, we can use this package that, Jason, to install other perhaps reac components.
95
00:07:19,270 --> 00:07:26,410
So if we go to something like material UI, you'll see that I can install component library material
96
00:07:26,420 --> 00:07:33,580
UI just by running NPM install and it's going to get added to our package, that JSON file we're going
97
00:07:33,580 --> 00:07:39,550
to be exploring, create, react app and other parts of this application throughout the course.
98
00:07:39,760 --> 00:07:41,350
But the last thing I want to touch on.
99
00:07:42,270 --> 00:07:48,570
Is what reactors actually doing underneath the hood, if we go to the public folder and go to index
100
00:07:48,910 --> 00:07:52,680
e-mail, we have all this pre set up code for us.
101
00:07:53,220 --> 00:08:00,990
But the key thing is that when we look at the body tag, the only thing we have is this div ID of root.
102
00:08:01,680 --> 00:08:05,820
Now this is where we're going to inject our react application.
103
00:08:06,330 --> 00:08:14,280
But at the end of the day, all we're doing is just replacing whatever is here with a react application.
104
00:08:14,280 --> 00:08:20,280
But that doesn't mean that I can't keep just coding along and building something else, like a Halo
105
00:08:20,590 --> 00:08:21,480
HTML tag.
106
00:08:22,500 --> 00:08:26,670
If I say this and run, npm start.
107
00:08:29,090 --> 00:08:31,640
If I go back to my app over here.
108
00:08:32,929 --> 00:08:41,780
And I scroll down, you'll see that look at that I've added hello, so my app is part react, part HDMI.
109
00:08:42,880 --> 00:08:47,800
Very, very cool, so react is something that we can inject even into parts of our application.
110
00:08:49,590 --> 00:08:58,380
If I right click here and do inspect and go to the elements, you'll see that this application is,
111
00:08:58,590 --> 00:09:06,840
well, d'Hiv Idea route and then we have this app inside of here that is just HTML tags if I open up
112
00:09:07,230 --> 00:09:09,360
my react developer tools.
113
00:09:11,450 --> 00:09:16,420
Once again, you'll see that the developer tools actually just notices are reachout.
114
00:09:17,730 --> 00:09:23,490
And it has this app component that it's created for us, but at the end of the day, it's the same thing
115
00:09:23,490 --> 00:09:25,170
as the e-mail we see here.
116
00:09:26,800 --> 00:09:34,870
Finally, if we go to App Dogs, we'll notice that we are importing react and if we go to index dogs,
117
00:09:35,020 --> 00:09:37,390
we have something called react Dom.
118
00:09:38,820 --> 00:09:44,190
Now, moving forward, I want you to think of these two libraries are just doing these things.
119
00:09:45,860 --> 00:09:55,430
One is that this REACT library allows us to write this XML like syntax inside a JavaScript file, and
120
00:09:55,430 --> 00:09:58,280
it understands it because of this react library.
121
00:09:59,290 --> 00:10:06,250
The second thing is that this react, Dom, is that little robot from our previous section.
122
00:10:07,440 --> 00:10:13,410
Remember this little guy that actually interacts with the dump, that's the reactor dump, that's the
123
00:10:13,410 --> 00:10:19,080
little robot that can be replaced with, well, different robots, maybe the one that interacts with
124
00:10:19,080 --> 00:10:20,790
a mobile phone or a desktop.
125
00:10:22,070 --> 00:10:29,000
This is the react package, it allows us to right Jeff Sachs and bill components and build that virtual
126
00:10:29,000 --> 00:10:30,900
dome and react.
127
00:10:30,900 --> 00:10:36,030
Dom is this little robot that interacts actually interact with the dome.
128
00:10:36,590 --> 00:10:45,560
So if we go to the code, you see that reactant render allows us to grab an element from HTML and insert
129
00:10:45,560 --> 00:10:46,510
app into it.
130
00:10:46,520 --> 00:10:47,570
That's all it's doing.
131
00:10:48,440 --> 00:10:48,890
All right.
132
00:10:48,920 --> 00:10:49,730
That's enough for now.
133
00:10:49,940 --> 00:10:51,500
Let's keep going in the next video.
13200
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.