Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,439 --> 00:00:06,560
now we are on the
2
00:00:04,000 --> 00:00:09,040
official site of next as and if you head
3
00:00:06,560 --> 00:00:11,920
over the showcase tab this specific
4
00:00:09,040 --> 00:00:14,960
webpage shows hundreds of beautiful
5
00:00:11,920 --> 00:00:17,680
websites built with nextgs and let's use
6
00:00:14,960 --> 00:00:19,279
this website to demonstrate our next
7
00:00:17,680 --> 00:00:21,199
image component
8
00:00:19,279 --> 00:00:24,720
as this specific website
9
00:00:21,199 --> 00:00:27,279
uses the next image component to display
10
00:00:24,720 --> 00:00:29,920
all these pretty images right here
11
00:00:27,279 --> 00:00:33,120
now let's head over to our developer
12
00:00:29,920 --> 00:00:35,840
tools and go to the network tab and
13
00:00:33,120 --> 00:00:38,160
inspect the network so we can see what
14
00:00:35,840 --> 00:00:40,640
the size of these images are
15
00:00:38,160 --> 00:00:42,800
so here let's head over to developer
16
00:00:40,640 --> 00:00:44,960
tools
17
00:00:42,800 --> 00:00:46,960
and then let's head to network tab here
18
00:00:44,960 --> 00:00:49,760
so you can already see the size column
19
00:00:46,960 --> 00:00:50,559
here this shows the size for every file
20
00:00:49,760 --> 00:00:53,760
so
21
00:00:50,559 --> 00:00:55,039
let's clear it and select image here if
22
00:00:53,760 --> 00:00:56,800
not already
23
00:00:55,039 --> 00:00:59,840
now if you notice right here we are on a
24
00:00:56,800 --> 00:01:02,640
responsive site so now let's see what
25
00:00:59,840 --> 00:01:05,519
the specific image size is
26
00:01:02,640 --> 00:01:08,240
that next.js uses for this specific
27
00:01:05,519 --> 00:01:11,880
viewport so now let's go ahead and empty
28
00:01:08,240 --> 00:01:11,880
cache and hard reload
29
00:01:12,000 --> 00:01:15,759
all right so now that we have done that
30
00:01:14,000 --> 00:01:18,479
you can see the different file sizes
31
00:01:15,759 --> 00:01:21,040
right here right so now let's go
32
00:01:18,479 --> 00:01:22,640
and pick one of these images now let's
33
00:01:21,040 --> 00:01:24,720
go with this one because this one has a
34
00:01:22,640 --> 00:01:27,840
dog and i really love dogs because i
35
00:01:24,720 --> 00:01:30,159
have one right and it says make your day
36
00:01:27,840 --> 00:01:31,240
now if you take a look at the file size
37
00:01:30,159 --> 00:01:35,520
it is
38
00:01:31,240 --> 00:01:37,439
66.8 kilobytes now this is the file size
39
00:01:35,520 --> 00:01:40,960
for this specific viewport that next
40
00:01:37,439 --> 00:01:43,280
year's image component uses right
41
00:01:40,960 --> 00:01:45,920
and has downloaded that specific image
42
00:01:43,280 --> 00:01:49,040
so now let's go ahead and change it to
43
00:01:45,920 --> 00:01:51,600
maybe iphone 678 version which has a
44
00:01:49,040 --> 00:01:53,840
slightly smaller viewport and let's see
45
00:01:51,600 --> 00:01:55,439
how the next image component performs
46
00:01:53,840 --> 00:01:56,600
now let's make sure that we remember
47
00:01:55,439 --> 00:02:00,159
this number
48
00:01:56,600 --> 00:02:02,640
66.8 right and it is this specific image
49
00:02:00,159 --> 00:02:05,280
so now let's go ahead and do the same
50
00:02:02,640 --> 00:02:08,080
thing again right click and let's empty
51
00:02:05,280 --> 00:02:09,360
cache and hard reload
52
00:02:08,080 --> 00:02:13,200
and now
53
00:02:09,360 --> 00:02:15,360
let's see what the file size is now so
54
00:02:13,200 --> 00:02:18,080
again it was a third from the bottom
55
00:02:15,360 --> 00:02:21,040
right and this is that image right here
56
00:02:18,080 --> 00:02:22,400
so now if you close it you can see that
57
00:02:21,040 --> 00:02:24,319
it's actually
58
00:02:22,400 --> 00:02:28,080
35.9
59
00:02:24,319 --> 00:02:32,720
kilobytes now isn't that crazy and isn't
60
00:02:28,080 --> 00:02:36,640
that amazing we literally went from 66
61
00:02:32,720 --> 00:02:38,480
to approximately 36 kilobytes now now
62
00:02:36,640 --> 00:02:40,080
that's approximately less than half the
63
00:02:38,480 --> 00:02:41,840
size
64
00:02:40,080 --> 00:02:44,080
so this is what the next js image
65
00:02:41,840 --> 00:02:46,400
component does based on the specific
66
00:02:44,080 --> 00:02:48,959
viewport it is automatically going to
67
00:02:46,400 --> 00:02:50,800
render a different file size and you can
68
00:02:48,959 --> 00:02:53,040
already see this helps so much with
69
00:02:50,800 --> 00:02:55,760
performance because when you are on a
70
00:02:53,040 --> 00:02:58,400
smaller viewport that is a mobile device
71
00:02:55,760 --> 00:03:01,920
most likely right you don't want to load
72
00:02:58,400 --> 00:03:04,480
a desktop image here right so next.js
73
00:03:01,920 --> 00:03:06,640
takes care of it for you
74
00:03:04,480 --> 00:03:08,640
all right the next thing let's take a
75
00:03:06,640 --> 00:03:12,959
look at the pre fetching feature of
76
00:03:08,640 --> 00:03:14,879
nexus image component so now again let's
77
00:03:12,959 --> 00:03:17,440
try and scroll down we have cleared the
78
00:03:14,879 --> 00:03:20,000
network and let's see what happens
79
00:03:17,440 --> 00:03:22,480
now as we scroll down you can see how
80
00:03:20,000 --> 00:03:25,200
the images are getting downloaded as we
81
00:03:22,480 --> 00:03:28,000
scroll down so as the images are about
82
00:03:25,200 --> 00:03:30,159
to come in viewport you can see that
83
00:03:28,000 --> 00:03:32,720
this specific image is not even in the
84
00:03:30,159 --> 00:03:34,799
viewport yet but it i'm pretty sure it's
85
00:03:32,720 --> 00:03:36,959
coming up after this one
86
00:03:34,799 --> 00:03:38,959
and look at that and next yes is
87
00:03:36,959 --> 00:03:41,120
essentially prefetching that specific
88
00:03:38,959 --> 00:03:43,760
image so the user gets a really good
89
00:03:41,120 --> 00:03:46,959
user experience but we also see a
90
00:03:43,760 --> 00:03:48,959
performant application as well because
91
00:03:46,959 --> 00:03:50,080
we are only downloading the specific
92
00:03:48,959 --> 00:03:53,200
image
93
00:03:50,080 --> 00:03:54,959
as the user is about to enter that
94
00:03:53,200 --> 00:03:57,519
specific area
95
00:03:54,959 --> 00:04:00,799
now isn't that amazing the next image
96
00:03:57,519 --> 00:04:02,480
component is really really powerful
97
00:04:00,799 --> 00:04:04,640
now that we learned so much more about
98
00:04:02,480 --> 00:04:07,519
images we will keep taking a look at
99
00:04:04,640 --> 00:04:08,879
performance as we build the projects
100
00:04:07,519 --> 00:04:11,360
together
101
00:04:08,879 --> 00:04:14,360
let's take a look at another benefit of
102
00:04:11,360 --> 00:04:14,360
nexus
7246
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.