Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,070 --> 00:00:05,630
Now, we are going to dive super deep
2
00:00:05,630 --> 00:00:09,730
into NextJS throughout this entire course.
3
00:00:09,730 --> 00:00:12,860
Nonetheless, I think it's also pretty nice
4
00:00:12,860 --> 00:00:15,540
to get our hands dirty now already
5
00:00:15,540 --> 00:00:20,540
and to at least explore how a NextJS app works and behaves.
6
00:00:21,000 --> 00:00:23,960
And for this, in this project, which we created,
7
00:00:23,960 --> 00:00:27,780
in this terminal navigated into this project folder,
8
00:00:27,780 --> 00:00:30,550
we can now run npm run dev.
9
00:00:30,550 --> 00:00:32,630
This runs one of the built-in scripts,
10
00:00:32,630 --> 00:00:35,800
which we find here in the package.json file
11
00:00:35,800 --> 00:00:40,800
and npm run dev spins up our development server.
12
00:00:40,890 --> 00:00:42,840
That is a built-in server,
13
00:00:42,840 --> 00:00:47,840
which serves our NextJS pages and the overall application.
14
00:00:47,940 --> 00:00:49,720
It will watch our code
15
00:00:49,720 --> 00:00:52,640
and whenever we save changes to files,
16
00:00:52,640 --> 00:00:56,100
it will automatically reload and update the pages we see
17
00:00:56,100 --> 00:00:58,500
in the browser and it will, in general,
18
00:00:58,500 --> 00:01:01,760
give us a great development experience.
19
00:01:01,760 --> 00:01:05,170
Later, once we're ready to deploy our application,
20
00:01:05,170 --> 00:01:07,450
we're going to run npm run build
21
00:01:07,450 --> 00:01:09,190
to build it for production
22
00:01:09,190 --> 00:01:13,200
to produce an optimized output for deployment
23
00:01:13,200 --> 00:01:18,200
and npm start later then to start this optimized server
24
00:01:19,120 --> 00:01:22,330
because we are working with a real server here,
25
00:01:22,330 --> 00:01:24,610
a Node.js-based server,
26
00:01:24,610 --> 00:01:27,130
since we need that page pre-rendering,
27
00:01:27,130 --> 00:01:28,830
which happens on the server.
28
00:01:28,830 --> 00:01:31,820
But that is already a little bit too much right now.
29
00:01:31,820 --> 00:01:34,900
We are going to dive into that throughout the course
30
00:01:34,900 --> 00:01:38,970
and we are going to learn how to deploy and so on.
31
00:01:38,970 --> 00:01:40,140
And therefore right now,
32
00:01:40,140 --> 00:01:42,040
let's use this dev script
33
00:01:42,040 --> 00:01:44,850
and spin up that development server.
34
00:01:44,850 --> 00:01:47,620
Now, this will then serve this Next application
35
00:01:47,620 --> 00:01:50,690
by default on localhost:3000
36
00:01:50,690 --> 00:01:52,758
as you see in the output down there.
37
00:01:52,758 --> 00:01:57,020
And therefore, you can visit localhost:3000
38
00:01:57,020 --> 00:01:59,440
and you should see something like this.
39
00:01:59,440 --> 00:02:02,470
The exact starting screen could change over time
40
00:02:02,470 --> 00:02:04,250
but it should be something like this
41
00:02:04,250 --> 00:02:06,970
and if you are using my attached snapshot,
42
00:02:06,970 --> 00:02:09,690
you will definitely see this.
43
00:02:09,690 --> 00:02:11,890
Now, what we see on this screen
44
00:02:11,890 --> 00:02:15,460
is actually the result of this index.js file
45
00:02:15,460 --> 00:02:17,440
in the pages folder.
46
00:02:17,440 --> 00:02:21,080
In there, we have a regular React component,
47
00:02:21,080 --> 00:02:23,160
a functional component,
48
00:02:23,160 --> 00:02:27,060
which returns JSX just as we know it from React
49
00:02:27,060 --> 00:02:31,830
but this component here is actually now pre-rendered
50
00:02:31,830 --> 00:02:34,480
and hence, if we view the page source here
51
00:02:34,480 --> 00:02:38,218
in localhost:3000, we find all that content,
52
00:02:38,218 --> 00:02:41,700
which we see on the screen, all that text and so on,
53
00:02:41,700 --> 00:02:44,510
here in the HTML Markup
54
00:02:44,510 --> 00:02:47,020
because this page was pre-rendered
55
00:02:47,020 --> 00:02:49,380
because I did mention that this would be one
56
00:02:49,380 --> 00:02:52,780
of the key features offered by NextJS,
57
00:02:52,780 --> 00:02:55,680
this built-in page pre-rendering,
58
00:02:55,680 --> 00:02:59,130
which we don't have in standard React apps.
59
00:02:59,130 --> 00:03:01,030
So out of the box, we got this
60
00:03:01,030 --> 00:03:04,380
and we can now start working on this project here
61
00:03:04,380 --> 00:03:06,700
or on this page.
62
00:03:06,700 --> 00:03:09,330
And since it is a regular React component,
63
00:03:09,330 --> 00:03:12,970
we can do whatever we can do with React components.
64
00:03:12,970 --> 00:03:16,560
Manage state, render different JSX content
65
00:03:16,560 --> 00:03:19,640
for different states and so on.
66
00:03:19,640 --> 00:03:22,040
But since we're going to dive way deeper
67
00:03:22,040 --> 00:03:24,180
into all these core features
68
00:03:24,180 --> 00:03:27,730
and how we build a NextJS application
69
00:03:27,730 --> 00:03:31,539
with multiple pages and with other React components,
70
00:03:31,539 --> 00:03:34,280
since we are going to dive into all of that,
71
00:03:34,280 --> 00:03:37,690
I will keep this first example very simple
72
00:03:37,690 --> 00:03:40,810
and I will simple clear all the content we have
73
00:03:40,810 --> 00:03:43,467
in this main div here,
74
00:03:43,467 --> 00:03:45,830
all that content, I'll clear it
75
00:03:45,830 --> 00:03:47,480
so that only the div is left
76
00:03:47,480 --> 00:03:48,860
and get rid of this import,
77
00:03:48,860 --> 00:03:51,210
which we don't fully understand yet
78
00:03:51,210 --> 00:03:54,000
but which we will reintroduce later.
79
00:03:54,000 --> 00:03:55,303
And then here in this div,
80
00:03:55,303 --> 00:03:57,910
I'll just add a h1 tag
81
00:03:57,910 --> 00:04:02,210
where I say Hello Next World!
82
00:04:02,210 --> 00:04:03,585
And if we now save this,
83
00:04:03,585 --> 00:04:05,080
the save is picked up,
84
00:04:05,080 --> 00:04:07,050
the dev server updates the page
85
00:04:07,050 --> 00:04:09,750
and we now see this on the screen.
86
00:04:09,750 --> 00:04:12,330
And again, if we view the page source,
87
00:04:12,330 --> 00:04:15,180
we also find this text content here
88
00:04:15,180 --> 00:04:19,160
in the source code so that pre-rendering still works out
89
00:04:19,160 --> 00:04:20,579
of the box.
90
00:04:20,579 --> 00:04:23,290
And that's our first NextJS application,
91
00:04:23,290 --> 00:04:25,660
our first NextJS project.
92
00:04:25,660 --> 00:04:27,630
Arguably not too exciting
93
00:04:27,630 --> 00:04:30,442
but we are going to dive way deeper into NextJS
94
00:04:30,442 --> 00:04:33,163
in the next course sections now.
7176
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.