All language subtitles for 009 Building Nested Dynamic Routes & Paths_Downloadly.ir_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,130 --> 00:00:05,330 Now, when working with such dynamic routes, 2 00:00:05,330 --> 00:00:10,330 such dynamic paths, there are two interesting variations 3 00:00:10,470 --> 00:00:14,640 or extensions of that concept you should be aware of. 4 00:00:14,640 --> 00:00:18,050 One variation or extension is that you can, 5 00:00:18,050 --> 00:00:21,930 of course also have nested dynamic paths. 6 00:00:21,930 --> 00:00:25,583 So let's say besides portfolio slash projectid, 7 00:00:26,470 --> 00:00:29,660 we also have another folder, 8 00:00:29,660 --> 00:00:32,479 the clients folder let's say 9 00:00:32,479 --> 00:00:35,930 and we wanna construct a nested path here, 10 00:00:35,930 --> 00:00:39,230 where we have dynamic client id, 11 00:00:39,230 --> 00:00:41,680 which can be different for the different clients. 12 00:00:41,680 --> 00:00:46,680 And then for every client id, we have some static pages 13 00:00:47,700 --> 00:00:51,130 like a list of all projects we did with that client 14 00:00:51,130 --> 00:00:54,820 but then also dynamic nested paths 15 00:00:54,820 --> 00:00:58,480 for the individual projects we did with a client. 16 00:00:58,480 --> 00:00:59,670 Not clear what I mean? 17 00:00:59,670 --> 00:01:00,970 Let me show it to you. 18 00:01:00,970 --> 00:01:05,519 So for clients, I might want an index.js file 19 00:01:05,519 --> 00:01:08,630 where I list all my clients. 20 00:01:08,630 --> 00:01:10,840 So here we could have a function 21 00:01:10,840 --> 00:01:12,730 with a name ClientsPage 22 00:01:13,780 --> 00:01:17,088 and then I return a div here with a h1 tag 23 00:01:17,088 --> 00:01:20,630 of The Clients Page 24 00:01:22,150 --> 00:01:23,993 and close the div of course. 25 00:01:25,060 --> 00:01:26,860 And I export that, 26 00:01:26,860 --> 00:01:30,260 and of course that's nothing new here at this point. 27 00:01:30,260 --> 00:01:33,880 But then I wanna have a dynamic path, 28 00:01:33,880 --> 00:01:37,300 but a dynamic path with nested paths. 29 00:01:37,300 --> 00:01:41,230 So not a file named square bracket something js 30 00:01:41,230 --> 00:01:44,180 but instead we can have a sub folder, 31 00:01:44,180 --> 00:01:47,660 which also has this square bracket name. 32 00:01:47,660 --> 00:01:50,540 So here we could then have the id of a client 33 00:01:50,540 --> 00:01:51,880 but now that's not a file, 34 00:01:51,880 --> 00:01:55,370 that's a folder with this special name. 35 00:01:55,370 --> 00:01:58,730 And then here again, we could have a index.js file 36 00:01:58,730 --> 00:02:03,440 and that could, for example, list all the Projects 37 00:02:05,050 --> 00:02:07,030 or all the Client Projects. 38 00:02:07,030 --> 00:02:10,550 So all the Projects for a given selected client 39 00:02:10,550 --> 00:02:12,760 and hence here, I have a div, 40 00:02:12,760 --> 00:02:17,623 where I say The Projects of a Given Client 41 00:02:20,410 --> 00:02:22,923 and maybe export this as well. 42 00:02:24,090 --> 00:02:26,150 And we could have more aesthetic files here 43 00:02:26,150 --> 00:02:29,050 like an overview.js file or whatever 44 00:02:29,050 --> 00:02:32,650 but we can now also have another dynamic folder 45 00:02:32,650 --> 00:02:37,400 or file nested inside of this already dynamic folder. 46 00:02:37,400 --> 00:02:40,810 For example, let's say for a selected client, 47 00:02:40,810 --> 00:02:42,900 we then have different projects, 48 00:02:42,900 --> 00:02:46,700 so here we have the clientprojectid identifier. 49 00:02:46,700 --> 00:02:49,490 And of course, as always what you write 50 00:02:49,490 --> 00:02:51,693 between the square brackets is up to you. 51 00:02:52,540 --> 00:02:55,930 So this could then be a page for an individual project 52 00:02:55,930 --> 00:02:57,860 for a selected client. 53 00:02:57,860 --> 00:03:01,570 So the SelectedClientProjectPage whatever, 54 00:03:01,570 --> 00:03:03,330 that could be a name here. 55 00:03:03,330 --> 00:03:05,830 And I'm just coming up with some examples here 56 00:03:05,830 --> 00:03:09,170 because of course these are use cases you could encounter 57 00:03:09,170 --> 00:03:11,720 in a real app you're building. 58 00:03:11,720 --> 00:03:14,150 So The Project Page 59 00:03:14,150 --> 00:03:16,930 for a Specific 60 00:03:16,930 --> 00:03:17,763 Project 61 00:03:17,763 --> 00:03:19,800 for a Selected 62 00:03:19,800 --> 00:03:20,763 Client. 63 00:03:21,830 --> 00:03:24,723 And we can also export that. 64 00:03:26,930 --> 00:03:28,040 Okay, so with that, 65 00:03:28,040 --> 00:03:30,780 I added a bunch of new folders and files 66 00:03:30,780 --> 00:03:32,370 and the interesting thing of course is 67 00:03:32,370 --> 00:03:35,410 that we have this dynamic folder name. 68 00:03:35,410 --> 00:03:39,950 How could we now reach those different files and pages? 69 00:03:39,950 --> 00:03:44,950 Well we can enter slash clients to reach this index.js file 70 00:03:45,010 --> 00:03:47,260 and there's nothing special about this. 71 00:03:47,260 --> 00:03:52,040 If I enter slash clients, I see The Clients Page, 72 00:03:52,040 --> 00:03:55,853 which is the output of this functional component. 73 00:03:57,020 --> 00:04:01,920 But now we have this dynamic id segment folder 74 00:04:01,920 --> 00:04:05,860 and in there we have an index.js file as well, 75 00:04:05,860 --> 00:04:07,100 where we, for example, 76 00:04:07,100 --> 00:04:11,080 wanna list all the projects of a given client. 77 00:04:11,080 --> 00:04:14,920 So therefore, we could enter a clients slash max, 78 00:04:14,920 --> 00:04:18,000 if that would be the identifier of a given client. 79 00:04:18,000 --> 00:04:21,459 And we see The Projects of a Given Client, 80 00:04:21,459 --> 00:04:24,790 which is the output of this page here. 81 00:04:24,790 --> 00:04:27,020 And then we can also drill even deeper 82 00:04:27,020 --> 00:04:29,630 with yet another dynamic segment 83 00:04:29,630 --> 00:04:34,630 with clients, max, project1, if that would then be the id 84 00:04:34,760 --> 00:04:39,373 of a specific project for this specific client. 85 00:04:40,500 --> 00:04:44,870 And therefore, we now see this output. 86 00:04:44,870 --> 00:04:47,710 And then all these pages we can of course get access 87 00:04:47,710 --> 00:04:51,540 to the concrete values entered in the URL. 88 00:04:51,540 --> 00:04:54,310 So here in the SelectedClientProjectPage, 89 00:04:54,310 --> 00:04:55,970 we can, again import 90 00:04:57,307 --> 00:04:58,790 useRouter 91 00:04:58,790 --> 00:05:02,737 from 'next/router'. 92 00:05:04,130 --> 00:05:06,150 And then in here simply 93 00:05:07,310 --> 00:05:09,800 get access to the router by calling useRouter 94 00:05:10,820 --> 00:05:14,273 and then console logging router.query. 95 00:05:15,330 --> 00:05:17,263 And if we do that, 96 00:05:19,210 --> 00:05:22,030 we see that we did do get an object 97 00:05:22,030 --> 00:05:24,050 with two properties now 98 00:05:24,050 --> 00:05:27,840 because I am logging this inner component 99 00:05:27,840 --> 00:05:31,570 that is loaded for a file name with a dynamic segment, 100 00:05:31,570 --> 00:05:34,820 which is inside of a folder with a dynamic segment. 101 00:05:34,820 --> 00:05:38,280 And you always get access to all the concrete values 102 00:05:38,280 --> 00:05:41,680 for the different placeholders that might've been 103 00:05:41,680 --> 00:05:43,940 part of the overall path 104 00:05:43,940 --> 00:05:47,040 for which this component was loaded. 105 00:05:47,040 --> 00:05:50,150 So therefore, we get access to the concrete id value, 106 00:05:50,150 --> 00:05:52,420 since we're in that dynamic id folder. 107 00:05:52,420 --> 00:05:56,440 And then since we're in this dynamic clientprojectid file, 108 00:05:56,440 --> 00:05:59,690 we also access to that concrete value. 109 00:05:59,690 --> 00:06:02,580 So that we can use all these values 110 00:06:02,580 --> 00:06:06,530 in our project or in our component file here 111 00:06:06,530 --> 00:06:08,880 to then fetch the specific project 112 00:06:08,880 --> 00:06:11,683 for this specific client, for example. 113 00:06:13,280 --> 00:06:15,900 Now, if I would use 114 00:06:16,790 --> 00:06:17,830 useRouter 115 00:06:17,830 --> 00:06:22,290 in the index.js file instead of the id folder here 116 00:06:22,290 --> 00:06:24,820 and therefore of course, we also need to 117 00:06:24,820 --> 00:06:27,460 import useRouter here as well. 118 00:06:27,460 --> 00:06:31,720 So if we import useRouter from next slash router, 119 00:06:31,720 --> 00:06:34,470 if I do that, then you will see 120 00:06:34,470 --> 00:06:38,100 that if I visit just slash max 121 00:06:38,100 --> 00:06:40,110 and therefore this index.js file, 122 00:06:40,110 --> 00:06:44,680 we of course only get access to the id property here 123 00:06:44,680 --> 00:06:47,420 because that is well just in the id folder 124 00:06:47,420 --> 00:06:51,163 and not inside of this clientprojectid JavaScript file now. 125 00:06:52,040 --> 00:06:54,630 So that's how we can load pages dynamically 126 00:06:54,630 --> 00:06:57,680 for various dynamic parameters 127 00:06:57,680 --> 00:07:01,180 and how we can get access to these parameter values. 128 00:07:01,180 --> 00:07:04,290 And as mentioned before, in the upcoming sections 129 00:07:04,290 --> 00:07:06,230 about data fetching and so on, 130 00:07:06,230 --> 00:07:08,790 we are of course also going to leverage 131 00:07:08,790 --> 00:07:10,603 those dynamic values. 10101

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.