Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,100 --> 00:00:04,830
Now for this section, I wanna start
2
00:00:04,830 --> 00:00:07,200
with a traditional React App.
3
00:00:07,200 --> 00:00:10,570
And I wanna come back to one of the main assets,
4
00:00:10,570 --> 00:00:13,950
One of the main reasons for using next JS,
5
00:00:13,950 --> 00:00:16,270
which I did already talk about
6
00:00:16,270 --> 00:00:19,270
in the first course section as well,
7
00:00:19,270 --> 00:00:22,680
this here is a dummy page rendered
8
00:00:22,680 --> 00:00:25,660
by a Standard React Application.
9
00:00:25,660 --> 00:00:30,270
To be precise by this React Application here.
10
00:00:30,270 --> 00:00:34,750
I just created a very simple React App with one component,
11
00:00:34,750 --> 00:00:37,820
the app component and there I fetch data
12
00:00:37,820 --> 00:00:40,630
from a dummy-backend which is adjacent file
13
00:00:40,630 --> 00:00:41,900
in my public folder,
14
00:00:41,900 --> 00:00:44,850
which is therefore served by this development server.
15
00:00:44,850 --> 00:00:46,820
And in there I got some dummy data,
16
00:00:46,820 --> 00:00:49,420
but the important thing is that I'm not loading
17
00:00:49,420 --> 00:00:52,970
the data in my JavaScript code
18
00:00:52,970 --> 00:00:55,990
by importing that file or anything like that.
19
00:00:55,990 --> 00:00:57,510
But that instead I send
20
00:00:57,510 --> 00:01:00,720
the HTTP requests to that file,
21
00:01:00,720 --> 00:01:03,910
once everything is up and running in the browser,
22
00:01:03,910 --> 00:01:06,130
and then I load data extracted,
23
00:01:06,130 --> 00:01:09,410
set my state and rendered the data.
24
00:01:09,410 --> 00:01:11,660
Now, what we see there for is
25
00:01:11,660 --> 00:01:13,410
that dummy data on the screen.
26
00:01:13,410 --> 00:01:18,410
But if we then view the page source of this file,
27
00:01:18,920 --> 00:01:22,286
we see that on there in this page source code,
28
00:01:22,286 --> 00:01:25,163
the data is nowhere to be found.
29
00:01:26,000 --> 00:01:30,080
We only got this empty div here with the id="root",
30
00:01:30,080 --> 00:01:33,220
which is the different in which our React Application
31
00:01:33,220 --> 00:01:35,450
is actually rendered,
32
00:01:35,450 --> 00:01:37,870
and we can see that rendered application
33
00:01:37,870 --> 00:01:40,018
if we inspect that page where we then see
34
00:01:40,018 --> 00:01:44,620
the actual Dom, as it's currently rendered.
35
00:01:44,620 --> 00:01:48,200
There inside of the div with the id="root",
36
00:01:48,200 --> 00:01:52,070
we do see the an ordered list with the list items,
37
00:01:52,070 --> 00:01:53,890
but that's only the Dom
38
00:01:53,890 --> 00:01:56,880
as it was rendered by JavaScript
39
00:01:56,880 --> 00:01:59,630
and by the react up deal for all
40
00:01:59,630 --> 00:02:02,520
after we loaded the this Page.
41
00:02:02,520 --> 00:02:07,290
The actual HTML content served by the server.
42
00:02:07,290 --> 00:02:09,830
So loaded by the browser initially
43
00:02:09,830 --> 00:02:13,680
is this HTML code instead.
44
00:02:13,680 --> 00:02:17,210
And that code did not include any data.
45
00:02:17,210 --> 00:02:19,222
Now that can have a couple of disadvantages,
46
00:02:19,222 --> 00:02:23,690
as I already mentioned in the first course Section.
47
00:02:23,690 --> 00:02:26,610
For example, our users need to wait
48
00:02:26,610 --> 00:02:28,130
for the data to be loaded,
49
00:02:28,130 --> 00:02:30,940
to actually see something on the Screen.
50
00:02:30,940 --> 00:02:32,960
Now here that's Super fast
51
00:02:32,960 --> 00:02:35,550
because that dummy-backend file
52
00:02:35,550 --> 00:02:38,470
is served by my local development server,
53
00:02:38,470 --> 00:02:40,080
which runs on the same machine
54
00:02:40,080 --> 00:02:42,700
as the user's here during development.
55
00:02:42,700 --> 00:02:45,500
And therefore we don't really see a difference here,
56
00:02:45,500 --> 00:02:48,840
but for real pages where we fetch data
57
00:02:48,840 --> 00:02:51,020
from some backend API,
58
00:02:51,020 --> 00:02:54,200
loading that data could take a second or so.
59
00:02:54,200 --> 00:02:56,010
And therefore, we might have a delay.
60
00:02:56,010 --> 00:02:57,710
We might have a loading spinner,
61
00:02:57,710 --> 00:03:01,590
which our users have to see before the data arrives.
62
00:03:01,590 --> 00:03:03,460
So the user experience could
63
00:03:03,460 --> 00:03:06,910
be sup-optimal when fetching data like this
64
00:03:06,910 --> 00:03:09,304
not necessarily often, it's fine,
65
00:03:09,304 --> 00:03:12,850
but it could be now an even bigger problem
66
00:03:12,850 --> 00:03:15,333
could be search engine optimization though.
67
00:03:15,333 --> 00:03:17,122
If you are building an app
68
00:03:17,122 --> 00:03:19,940
where search engines like Google
69
00:03:19,940 --> 00:03:21,994
should be aware of your content,
70
00:03:21,994 --> 00:03:26,460
you'll have a problem because this HTML code,
71
00:03:26,460 --> 00:03:28,260
which is initially sent back
72
00:03:28,260 --> 00:03:30,560
by the server to declined,
73
00:03:30,560 --> 00:03:33,580
that is what search engines will see.
74
00:03:33,580 --> 00:03:36,230
And in there we got no content at all.
75
00:03:36,230 --> 00:03:38,310
So if our content matters
76
00:03:38,310 --> 00:03:40,510
and we want search engines to see
77
00:03:40,510 --> 00:03:43,380
and index that content sending back,
78
00:03:43,380 --> 00:03:45,490
this is bad.
79
00:03:45,490 --> 00:03:47,770
Now, again, that is not a problem
80
00:03:47,770 --> 00:03:50,820
for all Websites and Web Apps.
81
00:03:50,820 --> 00:03:52,720
For example, if you have a Web App
82
00:03:52,720 --> 00:03:55,610
where users need to log in anyways,
83
00:03:55,610 --> 00:03:58,830
if you have some Admin Dashboard built with react,
84
00:03:58,830 --> 00:04:01,272
then search engines might not matter to you
85
00:04:01,272 --> 00:04:04,870
because users are not going to find your page,
86
00:04:04,870 --> 00:04:08,030
your Admin Dashboard through a search engine.
87
00:04:08,030 --> 00:04:10,660
But if you do have a content heavy app,
88
00:04:10,660 --> 00:04:12,680
like a blog or a shop,
89
00:04:12,680 --> 00:04:14,280
then you of course typically
90
00:04:14,280 --> 00:04:16,867
do want search engines to find your content
91
00:04:16,867 --> 00:04:18,856
and sending back something like this
92
00:04:18,856 --> 00:04:20,298
then is bad.
93
00:04:20,298 --> 00:04:22,760
Now I did talk about that
94
00:04:22,760 --> 00:04:25,140
in the first course section already.
95
00:04:25,140 --> 00:04:27,010
I just wanted to bring it back
96
00:04:27,010 --> 00:04:30,170
into your memory because it does matter.
97
00:04:30,170 --> 00:04:31,790
That is an issue which
98
00:04:31,790 --> 00:04:34,550
we can have with Standard React,
99
00:04:34,550 --> 00:04:37,970
and the problem is that we fetch data
100
00:04:37,970 --> 00:04:41,990
in our component after the component was loaded.
101
00:04:41,990 --> 00:04:44,569
So we fetched data from the client-site,
102
00:04:44,569 --> 00:04:46,640
we send the request to the server
103
00:04:46,640 --> 00:04:49,870
after something was rendered to the screen.
104
00:04:49,870 --> 00:04:54,870
The initial response, the initial HTML page,
105
00:04:54,930 --> 00:04:56,910
which is sent back by to server
106
00:04:56,910 --> 00:04:59,908
to declined when the user first visits the page
107
00:04:59,908 --> 00:05:02,558
does not yet contain that data,
108
00:05:02,558 --> 00:05:05,280
and that can be a problem.
109
00:05:05,280 --> 00:05:07,880
And that is something where next
110
00:05:07,880 --> 00:05:11,390
JS with its server side capabilities
111
00:05:11,390 --> 00:05:13,803
and its building features can help Us.
8357
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.