All language subtitles for 017 The __app.js_ File & Layout Wrapper_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,120 --> 00:00:04,830 Now I did prepare some components here 2 00:00:04,830 --> 00:00:05,970 in the layout folder 3 00:00:05,970 --> 00:00:09,010 in the Components folder that give our pages, 4 00:00:09,010 --> 00:00:13,130 a general layout and also a main navigation bar 5 00:00:13,130 --> 00:00:17,033 which holds some links, some list items with links. 6 00:00:17,900 --> 00:00:19,680 We just need to use that. 7 00:00:19,680 --> 00:00:21,690 Now this layout component is built such 8 00:00:21,690 --> 00:00:24,460 that we can wrap it around other components 9 00:00:24,460 --> 00:00:27,090 so that we can wrap it around our content 10 00:00:27,090 --> 00:00:30,320 that should be framed by that layout 11 00:00:30,320 --> 00:00:34,000 because layout, this component uses props children 12 00:00:34,000 --> 00:00:37,690 to take what's between the opening and closing layout text 13 00:00:37,690 --> 00:00:40,933 and wrap this component around that content. 14 00:00:41,940 --> 00:00:43,730 That means that we can, for example, 15 00:00:43,730 --> 00:00:45,500 go to the starting page, 16 00:00:45,500 --> 00:00:47,820 so in NextJS and the Pages folder, 17 00:00:47,820 --> 00:00:51,520 and we can wrap meetup list with layout. 18 00:00:51,520 --> 00:00:54,370 Now for this, we also need to import layout, of course. 19 00:00:54,370 --> 00:00:57,490 So we import layout from going up, 20 00:00:57,490 --> 00:01:01,180 components, layout, layout. 21 00:01:01,180 --> 00:01:03,220 We can add this import, 22 00:01:03,220 --> 00:01:04,810 and once this import was added 23 00:01:04,810 --> 00:01:08,573 we can wrap layout around meetup lists like this. 24 00:01:09,530 --> 00:01:12,620 And if we do that and save this, we get an error 25 00:01:12,620 --> 00:01:14,780 that link is not defined. 26 00:01:14,780 --> 00:01:16,500 Now we get this error because 27 00:01:16,500 --> 00:01:18,820 in that main navigation component, 28 00:01:18,820 --> 00:01:20,300 I'm using the link component 29 00:01:20,300 --> 00:01:22,830 but I'm not importing it deliberately 30 00:01:22,830 --> 00:01:25,760 because I wanted to do this together with you again. 31 00:01:25,760 --> 00:01:28,110 We learned about this link component 32 00:01:28,110 --> 00:01:32,060 and we import it from next/link. 33 00:01:32,060 --> 00:01:34,360 And that allows us to create those links. 34 00:01:34,360 --> 00:01:36,630 However, the two prop then should be changed 35 00:01:36,630 --> 00:01:39,510 to ref because the link component offered 36 00:01:39,510 --> 00:01:43,090 by NextJS wants this ref prop 37 00:01:43,090 --> 00:01:46,790 where we define the destination of that link. 38 00:01:46,790 --> 00:01:49,990 But with that changed and with that link import added, 39 00:01:49,990 --> 00:01:52,980 if we now save everything and reload, 40 00:01:52,980 --> 00:01:56,420 we got this nice navigation bar at the top here 41 00:01:56,420 --> 00:01:58,630 and we've got a white border around that 42 00:01:58,630 --> 00:02:00,700 for that go into your global styles 43 00:02:00,700 --> 00:02:04,110 and here in body, set margin to zero. 44 00:02:04,110 --> 00:02:06,592 That's something I forgot for the starting project. 45 00:02:06,592 --> 00:02:11,110 But if we add margin zero to body in the global CSS file 46 00:02:11,110 --> 00:02:12,740 then this white border is gone, 47 00:02:12,740 --> 00:02:14,540 and now we got this frame here 48 00:02:15,580 --> 00:02:18,310 and now we can also click all meetups to go 49 00:02:18,310 --> 00:02:21,370 to this starting page and click add new meetup 50 00:02:21,370 --> 00:02:23,330 to go to this page. 51 00:02:23,330 --> 00:02:25,562 On this page, we are, of course 52 00:02:25,562 --> 00:02:26,450 still missing the layout though. 53 00:02:26,450 --> 00:02:28,300 We only have it on the starting page. 54 00:02:29,280 --> 00:02:33,270 Now we want to have it on this new meetup page as well, 55 00:02:33,270 --> 00:02:34,300 and therefore, of course, 56 00:02:34,300 --> 00:02:37,300 we can always wrap layout around our content 57 00:02:37,300 --> 00:02:40,900 on the new meetup page to add the layout here as well. 58 00:02:40,900 --> 00:02:44,500 But you will probably see that, this becomes cumbersome, 59 00:02:44,500 --> 00:02:47,450 the more pages our application has. 60 00:02:47,450 --> 00:02:49,580 If we have an application with dozens 61 00:02:49,580 --> 00:02:53,780 or maybe hundreds of pages wrapping our general layout 62 00:02:53,780 --> 00:02:56,370 around all the page contents, 63 00:02:56,370 --> 00:02:59,560 so going into all the page components to then wrap layout 64 00:02:59,560 --> 00:03:02,870 around the content that becomes cumbersome, 65 00:03:02,870 --> 00:03:07,550 and that's now where this _app.js file becomes important. 66 00:03:07,550 --> 00:03:10,080 This is a special file, which exists 67 00:03:10,080 --> 00:03:12,020 in this Pages folder out of the box 68 00:03:12,020 --> 00:03:13,830 at which you could create on your own as well 69 00:03:13,830 --> 00:03:16,620 if it doesn't exist in which should contain content 70 00:03:16,620 --> 00:03:17,800 like this. 71 00:03:17,800 --> 00:03:20,760 This is kind of your route component. 72 00:03:20,760 --> 00:03:23,049 This MyApp component, which is defined in there, 73 00:03:23,049 --> 00:03:27,200 and that is just a regular react component in the end. 74 00:03:27,200 --> 00:03:30,600 This special component acts as the root component 75 00:03:30,600 --> 00:03:32,353 NextJS will render. 76 00:03:33,230 --> 00:03:36,790 It receives props and uses object de-structuring here 77 00:03:36,790 --> 00:03:39,330 to pull information out of the props 78 00:03:39,330 --> 00:03:41,590 and the information it pulls out there, 79 00:03:41,590 --> 00:03:44,890 is a component prop and a page prop. 80 00:03:44,890 --> 00:03:46,830 These props are passed into this 81 00:03:46,830 --> 00:03:50,280 MyApp component automatically by NextJS, 82 00:03:50,280 --> 00:03:55,280 since NextJS is the thing using that specific component. 83 00:03:55,410 --> 00:03:59,120 and component is a prop that holds the actual page 84 00:03:59,120 --> 00:04:01,030 contents that should be rendered. 85 00:04:01,030 --> 00:04:02,070 So it will be different 86 00:04:02,070 --> 00:04:06,370 whenever we switch a page and page props are specific props 87 00:04:06,370 --> 00:04:08,540 our pages might be getting, 88 00:04:08,540 --> 00:04:10,580 and at the moment our pages are not getting 89 00:04:10,580 --> 00:04:12,060 any props at all, 90 00:04:12,060 --> 00:04:14,820 because at the moment we have no source 91 00:04:14,820 --> 00:04:16,950 that would provide such props 92 00:04:16,950 --> 00:04:19,870 but that is something we're going to change. 93 00:04:19,870 --> 00:04:22,850 But with that, we now know that component here 94 00:04:22,850 --> 00:04:25,700 in this _app.js file will in the end 95 00:04:25,700 --> 00:04:30,180 be the actual page content of our different pages. 96 00:04:30,180 --> 00:04:32,140 And it will change whenever we navigate 97 00:04:32,140 --> 00:04:33,973 from page A to page B. 98 00:04:35,070 --> 00:04:36,940 Now, since that's the case, 99 00:04:36,940 --> 00:04:39,179 we can utilize this _app.js file 100 00:04:39,179 --> 00:04:42,070 and simply wrap this component here 101 00:04:42,070 --> 00:04:45,820 with our layout or with whichever wrapper you have. 102 00:04:45,820 --> 00:04:47,630 And we then don't have to do it 103 00:04:47,630 --> 00:04:50,870 inside of our different page files. 104 00:04:50,870 --> 00:04:52,870 So we can remove the layout wrapper 105 00:04:52,870 --> 00:04:55,390 from index.js here from our homepage, 106 00:04:55,390 --> 00:04:57,600 we can remove that and go back 107 00:04:57,600 --> 00:05:00,070 to just returning the meetup list 108 00:05:00,070 --> 00:05:02,170 and remove the layout import here 109 00:05:03,080 --> 00:05:04,753 and instead go to _app.js, 110 00:05:05,600 --> 00:05:09,150 and then here, we import layout 111 00:05:09,150 --> 00:05:13,530 from going up one level diving into components, 112 00:05:13,530 --> 00:05:17,060 layout and then pointing at the layout file. 113 00:05:17,060 --> 00:05:19,330 And we now wrap this component here 114 00:05:19,330 --> 00:05:21,660 with the layout component. 115 00:05:21,660 --> 00:05:24,370 And that means that our different page contents 116 00:05:24,370 --> 00:05:27,273 will be wrapped with this layout component. 117 00:05:28,210 --> 00:05:30,220 And hence, if we now save all files 118 00:05:30,220 --> 00:05:33,970 with all those changes, now on the new meetup page, 119 00:05:33,970 --> 00:05:36,110 we also got this layout applied. 120 00:05:36,110 --> 00:05:37,690 We got the navigation bar, 121 00:05:37,690 --> 00:05:40,050 we got the extra styling, which ensures 122 00:05:40,050 --> 00:05:43,850 that the page content does not take the entire width. 123 00:05:43,850 --> 00:05:45,820 And hence now on all the pages, 124 00:05:45,820 --> 00:05:49,070 we got this layout and we don't need to wrap it 125 00:05:49,070 --> 00:05:51,022 around the different page contents inside 126 00:05:51,022 --> 00:05:52,870 of the different page files. 127 00:05:52,870 --> 00:05:54,870 And of course that therefore is the way, 128 00:05:54,870 --> 00:05:57,113 more maintainable and convenient approach 129 00:05:57,113 --> 00:06:02,113 of applying general components to our application. 130 00:06:02,290 --> 00:06:04,150 So whenever you have some component 131 00:06:04,150 --> 00:06:07,600 or some setting that affects all your pages 132 00:06:07,600 --> 00:06:11,530 you can utilize this _app.js file to easily add 133 00:06:11,530 --> 00:06:15,163 that without diving into dozens of files individually. 10398

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