Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,400 --> 00:00:04,130
Now, before we dig deeper,
2
00:00:04,130 --> 00:00:06,980
I again want to show this pre-rendering
3
00:00:06,980 --> 00:00:10,910
of multiple instances of this page, inaction.
4
00:00:10,910 --> 00:00:11,840
And for this again,
5
00:00:11,840 --> 00:00:15,070
we can run this NPM run build command here
6
00:00:15,070 --> 00:00:17,200
to build this for production.
7
00:00:17,200 --> 00:00:19,490
So NPM run build,
8
00:00:19,490 --> 00:00:20,730
and what this will do is it
9
00:00:20,730 --> 00:00:23,800
will create an optimized production build again,
10
00:00:23,800 --> 00:00:27,720
pre-rendering all the pages it needs to pre-render.
11
00:00:27,720 --> 00:00:30,100
And then we see what it did here again.
12
00:00:30,100 --> 00:00:33,470
We see that it pre-rendered a couple of pages.
13
00:00:33,470 --> 00:00:36,630
It generated five pages in the end here.
14
00:00:36,630 --> 00:00:40,480
We see that for the starting page for a slash nothing.
15
00:00:40,480 --> 00:00:42,550
So for this index JS file,
16
00:00:42,550 --> 00:00:47,030
it recognized this 10 seconds revalidation period.
17
00:00:47,030 --> 00:00:49,650
And we see that for this dynamic page here
18
00:00:49,650 --> 00:00:51,730
it generated three instances
19
00:00:51,730 --> 00:00:54,190
for P one, P two, P three
20
00:00:54,190 --> 00:00:55,330
which makes a lot of sense
21
00:00:55,330 --> 00:00:58,980
because these are the parent values I'm returning here
22
00:00:58,980 --> 00:01:00,810
in get static pulse.
23
00:01:00,810 --> 00:01:03,620
It also pre-generated the 404 page
24
00:01:03,620 --> 00:01:05,853
just as it did before already.
25
00:01:06,810 --> 00:01:07,970
Now we can also see this
26
00:01:07,970 --> 00:01:10,290
if we dive into the next folder again,
27
00:01:10,290 --> 00:01:12,270
into server pages.
28
00:01:12,270 --> 00:01:17,270
Here we see the HTML files for those different parameters.
29
00:01:17,280 --> 00:01:21,110
We also see the json files for pre-loading that data
30
00:01:21,110 --> 00:01:25,050
if we would navigate to such a page through a link.
31
00:01:25,050 --> 00:01:27,890
So after we already are on the page.
32
00:01:27,890 --> 00:01:30,350
Not for the initial page load.
33
00:01:30,350 --> 00:01:33,870
And if we have a look at those HTML files,
34
00:01:33,870 --> 00:01:35,970
in there, of course, ultimately
35
00:01:35,970 --> 00:01:40,970
somewhere we will see our product one text.
36
00:01:41,390 --> 00:01:42,630
Here it is.
37
00:01:42,630 --> 00:01:45,300
So we see that here as well.
38
00:01:45,300 --> 00:01:50,300
Now I can also show you that pre fetching of data though
39
00:01:50,910 --> 00:01:54,370
because in index JS, we do render some links.
40
00:01:54,370 --> 00:01:57,160
So now if I do run NPM, start here.
41
00:01:57,160 --> 00:02:01,090
If I do that to start that production server
42
00:02:01,090 --> 00:02:02,600
on our local machine,
43
00:02:02,600 --> 00:02:05,450
with that build project. If I reload
44
00:02:05,450 --> 00:02:07,180
we get these clickable links.
45
00:02:07,180 --> 00:02:09,789
And if you now open the developer tools here
46
00:02:09,789 --> 00:02:11,960
and go to the network tab.
47
00:02:11,960 --> 00:02:14,880
If I now reload, local host 3000
48
00:02:14,880 --> 00:02:16,930
you'll see something interesting.
49
00:02:16,930 --> 00:02:20,680
You see here, are requests to P one JSON,
50
00:02:20,680 --> 00:02:23,710
P two JSON and P three JSON.
51
00:02:23,710 --> 00:02:26,640
And if you click on them, you see what was fetched.
52
00:02:26,640 --> 00:02:30,360
And in the end here, it pre fetched the props for the
53
00:02:30,360 --> 00:02:32,040
that would need to be loaded
54
00:02:32,040 --> 00:02:34,710
if you click on one of these links.
55
00:02:34,710 --> 00:02:37,970
So in the end here, it pre fetched that data
56
00:02:37,970 --> 00:02:40,410
even before I hovered over the links
57
00:02:40,410 --> 00:02:43,060
just because I'm on this page.
58
00:02:43,060 --> 00:02:46,510
Now the exact point of time when data is pre fetched,
59
00:02:46,510 --> 00:02:49,760
that's something figured out and done by next to JS.
60
00:02:49,760 --> 00:02:52,070
The important part for us here is that
61
00:02:52,070 --> 00:02:55,430
it does that pre fetching for us.
62
00:02:55,430 --> 00:02:57,020
Now, when we now click on a link,
63
00:02:57,020 --> 00:02:58,840
we're not sending a new request
64
00:02:58,840 --> 00:03:03,080
to the server and load the pre-rendered HTML file.
65
00:03:03,080 --> 00:03:06,240
Instead we stay in this single page application now.
66
00:03:06,240 --> 00:03:08,660
We stay here in this react application
67
00:03:08,660 --> 00:03:13,160
which was loaded and hydrated after this initial request.
68
00:03:13,160 --> 00:03:17,590
So in the end now Java script will render a new page for uS.
69
00:03:17,590 --> 00:03:22,590
Just as it would do in a regular react app without next JS.
70
00:03:22,650 --> 00:03:25,630
But the data needed for this page is coming
71
00:03:25,630 --> 00:03:29,480
from the pre fetched JSON file, which it loaded and
72
00:03:29,480 --> 00:03:32,640
read under the hood on our behalf.
73
00:03:32,640 --> 00:03:35,430
So that it doesn't need to fetch the data
74
00:03:35,430 --> 00:03:37,850
after we navigated to that page.
75
00:03:37,850 --> 00:03:40,510
But so that the data is already there
76
00:03:40,510 --> 00:03:41,980
when we do navigate.
77
00:03:41,980 --> 00:03:46,050
To show this final product one page even faster.
78
00:03:46,050 --> 00:03:48,400
And that's another neat feature built
79
00:03:48,400 --> 00:03:51,640
into next JS, which we get for free.
80
00:03:51,640 --> 00:03:53,020
So to say.
81
00:03:53,020 --> 00:03:56,600
Now let's again explore this fallback key here
82
00:03:56,600 --> 00:03:57,903
in greater detail.
6264
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.