Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,040 --> 00:00:05,120
So now we know how to use the link.
2
00:00:05,120 --> 00:00:07,310
Now for longer POS,
3
00:00:07,310 --> 00:00:10,470
constructing a link destination like this.
4
00:00:10,470 --> 00:00:13,280
so by building a string like this
5
00:00:13,280 --> 00:00:16,149
can be cumbersome or annoying.
6
00:00:16,149 --> 00:00:21,130
That's why Next.js also gives you an alternative way
7
00:00:21,130 --> 00:00:24,080
an alternative value you can provide
8
00:00:24,080 --> 00:00:26,320
for the REFPROP on the link.
9
00:00:26,320 --> 00:00:28,080
Instead of providing a string
10
00:00:28,080 --> 00:00:30,210
which is the path you want to go to,
11
00:00:30,210 --> 00:00:32,920
you can provide an object.
12
00:00:32,920 --> 00:00:36,510
So now this is not a special double curly brace syntax,
13
00:00:36,510 --> 00:00:38,960
this is still single curly braces
14
00:00:38,960 --> 00:00:41,700
to evaluate a JavaScript expression,
15
00:00:41,700 --> 00:00:45,170
and the expression here then just is a new object
16
00:00:45,170 --> 00:00:46,500
which I'm creating.
17
00:00:46,500 --> 00:00:48,730
And here that's a special kind of object
18
00:00:48,730 --> 00:00:52,800
Next.js expects, as an alternative to a string
19
00:00:52,800 --> 00:00:54,540
as a value for the ref.
20
00:00:54,540 --> 00:00:59,540
And here we can set various properties Next.js is expecting.
21
00:00:59,840 --> 00:01:02,870
For example, the path name, property
22
00:01:02,870 --> 00:01:07,870
which here would be /clients/ and then important [Id]
23
00:01:09,420 --> 00:01:11,560
So we describe the path
24
00:01:11,560 --> 00:01:14,970
as it would lead to our file in the pages folder.
25
00:01:14,970 --> 00:01:17,010
So here we want to go into client's folder
26
00:01:17,010 --> 00:01:21,600
and then into the Id folder with square brackets around Id
27
00:01:21,600 --> 00:01:24,260
and then to the index.js file as you learned,
28
00:01:24,260 --> 00:01:27,830
that is then the default file Next.js we'll be looking for,
29
00:01:27,830 --> 00:01:32,830
hence, the path name here is /client/[Id].
30
00:01:32,910 --> 00:01:35,120
And then we need to let Next.js know,
31
00:01:35,120 --> 00:01:37,220
what the concrete value should be
32
00:01:37,220 --> 00:01:40,830
that should be plucked in for this ID here for this link,
33
00:01:40,830 --> 00:01:42,170
which we're building.
34
00:01:42,170 --> 00:01:44,930
And we do this through the query property
35
00:01:44,930 --> 00:01:48,290
which we can set into this ref object.
36
00:01:48,290 --> 00:01:50,170
And that then is an object
37
00:01:50,170 --> 00:01:54,430
just as it is when we retrieve it with use router.
38
00:01:54,430 --> 00:01:57,630
There query is also an object we can retrieve
39
00:01:57,630 --> 00:02:00,310
to have key value pairs where the keys
40
00:02:00,310 --> 00:02:03,660
are our dynamic segment identifiers
41
00:02:03,660 --> 00:02:06,690
and the values are the concrete values entered
42
00:02:06,690 --> 00:02:10,169
and it's the same here when we define a link.
43
00:02:10,169 --> 00:02:14,260
We then have a key which is our dynamic segment identifier.
44
00:02:14,260 --> 00:02:17,730
So Id in this case, and then the concrete value
45
00:02:17,730 --> 00:02:20,330
for this concrete link, which we're building here.
46
00:02:20,330 --> 00:02:22,910
So in this case, client.id
47
00:02:23,820 --> 00:02:26,010
and that that is then an alternative way
48
00:02:26,010 --> 00:02:27,930
of building that link.
49
00:02:27,930 --> 00:02:29,130
Now it's totally up to you,
50
00:02:29,130 --> 00:02:33,240
If you prefer this over creating a string or not,
51
00:02:33,240 --> 00:02:36,660
this is totally up to you, but you can build it like this.
52
00:02:36,660 --> 00:02:39,970
And if you then save this and reload
53
00:02:39,970 --> 00:02:44,750
you still have the client's page with those working links.
54
00:02:44,750 --> 00:02:48,020
And I'm just showing these alternatives so that you know
55
00:02:48,020 --> 00:02:50,830
all these different ways of using Next,
56
00:02:50,830 --> 00:02:53,700
and in this case of using the link component
4432
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.