All language subtitles for 008 Adding First Pages_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,040 --> 00:00:03,060 Now let's get started 2 00:00:03,060 --> 00:00:06,550 with writing some NextJS code here. 3 00:00:06,550 --> 00:00:09,530 And for this I'll shrink the terminal a little bit. 4 00:00:09,530 --> 00:00:11,690 And in this pages folder, 5 00:00:11,690 --> 00:00:15,000 we can ignore this _app.js file for the moment. 6 00:00:15,000 --> 00:00:18,040 We can delete the api folder in there. 7 00:00:18,040 --> 00:00:19,350 And in the styles folder 8 00:00:19,350 --> 00:00:22,750 we can also delete the Home.module.css file. 9 00:00:22,750 --> 00:00:24,930 We can keep the globals.css file 10 00:00:24,930 --> 00:00:25,853 if we want though. 11 00:00:26,900 --> 00:00:29,090 Now we got this index.js file. 12 00:00:29,090 --> 00:00:30,053 And in this file, 13 00:00:30,053 --> 00:00:35,053 * in the end just have a standard React component. 14 00:00:35,270 --> 00:00:36,580 But to make this even clearer 15 00:00:36,580 --> 00:00:38,350 let's delete this file as well 16 00:00:38,350 --> 00:00:41,330 so that the only remaining file in the pages folder 17 00:00:41,330 --> 00:00:43,890 is the _app.js file. 18 00:00:43,890 --> 00:00:47,160 And now let's say to get started with NextJS 19 00:00:47,160 --> 00:00:51,510 we wanna build a simple website with three kinds of pages, 20 00:00:51,510 --> 00:00:53,150 a starting page let's say, 21 00:00:53,150 --> 00:00:56,230 then a news page with a list of news 22 00:00:56,230 --> 00:00:59,060 and then a page for the news details. 23 00:00:59,060 --> 00:01:01,249 So when we click on a news item 24 00:01:01,249 --> 00:01:03,900 and we're taken to the full page 25 00:01:03,900 --> 00:01:06,710 for that specific news item. 26 00:01:06,710 --> 00:01:09,780 And if we wanted to create a structure like this, 27 00:01:09,780 --> 00:01:12,450 in NextJS in the pages folder here, 28 00:01:12,450 --> 00:01:15,600 we would create three files. 29 00:01:15,600 --> 00:01:18,960 The index.js file will be our route page. 30 00:01:18,960 --> 00:01:22,370 So if a request reaches our domain slash nothing 31 00:01:22,370 --> 00:01:24,930 just index.js will be loaded. 32 00:01:24,930 --> 00:01:27,920 That is in line with standard websites, 33 00:01:27,920 --> 00:01:29,760 if I may call it like this 34 00:01:29,760 --> 00:01:32,720 where we also have index.html files 35 00:01:32,720 --> 00:01:35,230 which are typically served as route pages, 36 00:01:35,230 --> 00:01:39,950 if a request just targets slash nothing after the domain. 37 00:01:39,950 --> 00:01:42,580 And here it's index.js, which will be served 38 00:01:42,580 --> 00:01:46,313 if a request reaches just our domain slash nothing. 39 00:01:47,240 --> 00:01:50,150 Then we might also have a news.js file 40 00:01:50,150 --> 00:01:53,780 for requests that reach our domain slash news. 41 00:01:53,780 --> 00:01:57,520 And that's important with the exception of the index name 42 00:01:57,520 --> 00:01:58,372 which is a special name, 43 00:01:58,372 --> 00:01:59,850 which is served whenever 44 00:01:59,850 --> 00:02:02,920 we have a request to just slash nothing, 45 00:02:02,920 --> 00:02:06,370 the file name will be used as a path name. 46 00:02:06,370 --> 00:02:08,919 So news.js the content in here, 47 00:02:08,919 --> 00:02:10,750 the React component in here, 48 00:02:10,750 --> 00:02:15,054 would be served for requests to our domain slash news, 49 00:02:15,054 --> 00:02:17,260 for example. 50 00:02:17,260 --> 00:02:19,600 So not news.js, but just news. 51 00:02:19,600 --> 00:02:22,310 Then then news.js file would be served. 52 00:02:22,310 --> 00:02:25,050 And I'll comment this out to leave that in here. 53 00:02:25,050 --> 00:02:29,053 index.js would be served for just our domain.com/nothing. 54 00:02:30,140 --> 00:02:31,660 And I'll come back to the page 55 00:02:31,660 --> 00:02:34,240 for a single news item later. 56 00:02:34,240 --> 00:02:37,410 For the moment, these are the two pages we have. 57 00:02:37,410 --> 00:02:40,530 And now what goes in those page files, 58 00:02:40,530 --> 00:02:41,850 I mentioned it before, 59 00:02:41,850 --> 00:02:44,000 our standard React component, 60 00:02:44,000 --> 00:02:46,850 the React components that should be loaded 61 00:02:46,850 --> 00:02:48,573 for that specific page. 62 00:02:49,550 --> 00:02:50,820 So here in index.js 63 00:02:50,820 --> 00:02:53,690 we can create a component just as we know it 64 00:02:53,690 --> 00:02:54,937 typically as a function 65 00:02:54,937 --> 00:02:57,750 and we could name it as HomePage. 66 00:02:57,750 --> 00:02:59,920 The component name is up to you. 67 00:02:59,920 --> 00:03:02,730 Now you must export this component 68 00:03:02,730 --> 00:03:07,600 so that NextJS is able to find it, so to say. 69 00:03:07,600 --> 00:03:09,950 And then in this component function 70 00:03:09,950 --> 00:03:11,650 you return JSX code 71 00:03:11,650 --> 00:03:14,140 just as you're used to. 72 00:03:14,140 --> 00:03:16,050 You return your JSX code, 73 00:03:16,050 --> 00:03:20,960 for example, a h1 tag where we say "The Home Page." 74 00:03:20,960 --> 00:03:23,470 That could be a very simple first page. 75 00:03:23,470 --> 00:03:26,050 Of course we're going to add more meaningful content 76 00:03:26,050 --> 00:03:27,520 in a second. 77 00:03:27,520 --> 00:03:30,200 Now we can copy this to news.js 78 00:03:30,200 --> 00:03:31,640 and add it here. 79 00:03:31,640 --> 00:03:32,510 As a side note, 80 00:03:32,510 --> 00:03:36,250 if you're wondering why we don't have any import statement 81 00:03:36,250 --> 00:03:37,720 like this at the top, 82 00:03:37,720 --> 00:03:40,090 where we import React from react. 83 00:03:40,090 --> 00:03:45,090 NextJS projects support this modern React setup 84 00:03:45,170 --> 00:03:47,460 where you can omit this import 85 00:03:47,460 --> 00:03:50,610 and it's added behind the scenes, so to say. 86 00:03:50,610 --> 00:03:51,443 And with that here 87 00:03:51,443 --> 00:03:52,360 in the news.js file 88 00:03:52,360 --> 00:03:55,530 we would have let's say NewsPage component 89 00:03:55,530 --> 00:03:58,220 and of course also export the news page, 90 00:03:58,220 --> 00:04:00,737 and here we could say "The News Page." 91 00:04:01,680 --> 00:04:02,990 And if we do that, 92 00:04:02,990 --> 00:04:05,140 if we add these two pages 93 00:04:05,140 --> 00:04:06,770 then in the terminal, 94 00:04:06,770 --> 00:04:08,790 in this integrated terminal here 95 00:04:08,790 --> 00:04:12,240 which has already navigated into this project folder 96 00:04:12,240 --> 00:04:16,370 we can start the development server with NPM and run dev. 97 00:04:16,370 --> 00:04:17,730 And that development server 98 00:04:17,730 --> 00:04:21,740 is given to us by that NextJS project setup. 99 00:04:21,740 --> 00:04:22,850 So with npm run dev, 100 00:04:22,850 --> 00:04:24,750 we start this development server. 101 00:04:24,750 --> 00:04:29,090 Here you see the URL where you can visit your page 102 00:04:29,090 --> 00:04:32,690 and therefore if I now visit localhost:3000 103 00:04:32,690 --> 00:04:35,370 I see the homepage. 104 00:04:35,370 --> 00:04:39,360 And if we instead would visit localhost:3000/news 105 00:04:39,360 --> 00:04:41,890 we see the news page. 106 00:04:41,890 --> 00:04:43,550 And now what's interesting is 107 00:04:43,550 --> 00:04:46,540 that the content is just some dummy content, 108 00:04:46,540 --> 00:04:50,490 but if we view the page source here 109 00:04:50,490 --> 00:04:52,700 off the loaded page, 110 00:04:52,700 --> 00:04:54,590 then we see that in there 111 00:04:54,590 --> 00:04:57,310 we don't just have an empty skeleton, 112 00:04:57,310 --> 00:04:58,800 but if we look up at closer, 113 00:04:58,800 --> 00:05:02,410 we find the actual page content in here. 114 00:05:02,410 --> 00:05:04,430 And that's an important difference 115 00:05:04,430 --> 00:05:05,910 to a standard React app 116 00:05:05,910 --> 00:05:10,040 where the page is not pre-rendered on the server. 117 00:05:10,040 --> 00:05:12,840 This HTML code which we see here 118 00:05:12,840 --> 00:05:16,560 is the HTML code sent back by the server. 119 00:05:16,560 --> 00:05:19,080 And since it contains that content here 120 00:05:19,080 --> 00:05:23,290 that means that the entire page was pre-rendered. 121 00:05:23,290 --> 00:05:25,580 And that's why the content ends up in here 122 00:05:25,580 --> 00:05:26,730 and the advantage's 123 00:05:26,730 --> 00:05:28,359 that we don't have any flickering on the page 124 00:05:28,359 --> 00:05:30,550 whilst we're waiting for it. 125 00:05:30,550 --> 00:05:31,940 And in addition, 126 00:05:31,940 --> 00:05:36,060 search engines would also see that content here. 127 00:05:36,060 --> 00:05:37,920 They see what our users see 128 00:05:37,920 --> 00:05:40,950 and that of course can be a great advantage. 129 00:05:40,950 --> 00:05:42,870 And this is how we can get started 130 00:05:42,870 --> 00:05:44,890 with this file based routing. 131 00:05:44,890 --> 00:05:48,270 And as you see, by looking at the page source, 132 00:05:48,270 --> 00:05:50,720 in addition to that file based routing, 133 00:05:50,720 --> 00:05:52,910 we also already use that 134 00:05:52,910 --> 00:05:55,150 built-in server-side rendering feature 135 00:05:55,150 --> 00:05:56,810 without any extra setup 136 00:05:56,810 --> 00:05:59,720 because it works out of the box. 137 00:05:59,720 --> 00:06:02,010 With that, let's now dig a bit deeper 138 00:06:02,010 --> 00:06:04,013 and let's see what else we can do here. 10205

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