All language subtitles for 018 Adding Links & Navigation_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:03,230 [Maximilian Schwarzmuller] Now let's take care 2 00:00:03,230 --> 00:00:08,220 about adding such a navigation bar to our application. 3 00:00:08,220 --> 00:00:10,740 And for this I'll go to the components folder 4 00:00:10,740 --> 00:00:12,640 and add a new folder in there. 5 00:00:12,640 --> 00:00:15,010 And I'll name it layout, because it will hold 6 00:00:15,010 --> 00:00:17,750 some general layout components. 7 00:00:17,750 --> 00:00:20,570 So a sub-folder inside of components, 8 00:00:20,570 --> 00:00:24,850 and in there I'll add the main navigation.js file, 9 00:00:24,850 --> 00:00:26,560 which is the file that should hold 10 00:00:26,560 --> 00:00:29,410 this main navigation component. 11 00:00:29,410 --> 00:00:32,330 Now I added it here in the components folder 12 00:00:32,330 --> 00:00:34,390 and not in the pages folder 13 00:00:34,390 --> 00:00:36,870 because this component will not be loaded 14 00:00:36,870 --> 00:00:39,500 as a page with help of the router, 15 00:00:39,500 --> 00:00:41,590 but instead we will embed it 16 00:00:41,590 --> 00:00:46,150 in the content of our other code just as we did before. 17 00:00:46,150 --> 00:00:49,320 Totally unrelated to the router. 18 00:00:49,320 --> 00:00:51,890 Now in this main navigation component file, 19 00:00:51,890 --> 00:00:55,700 we can again define our component function, 20 00:00:55,700 --> 00:01:00,700 MainNavigation, and export it as we're used to. 21 00:01:00,900 --> 00:01:04,090 And then of course return some JSX content here. 22 00:01:04,090 --> 00:01:06,560 And here I wanna return a header, 23 00:01:06,560 --> 00:01:10,690 a header component which in the end will then wrap 24 00:01:10,690 --> 00:01:15,030 all the items that should go into this header. 25 00:01:15,030 --> 00:01:19,230 And here I actually wanna have a div first with my logo, 26 00:01:19,230 --> 00:01:21,230 which in this case will just be some text. 27 00:01:21,230 --> 00:01:24,400 I'll name it React Meetups. 28 00:01:24,400 --> 00:01:27,450 And then next to this div, inside of the header, 29 00:01:27,450 --> 00:01:30,970 I'll add a nav element, and here I'll then add 30 00:01:30,970 --> 00:01:33,740 an unordered list with a couple of list items 31 00:01:33,740 --> 00:01:37,950 where all those list items will be the different links 32 00:01:37,950 --> 00:01:39,710 which we have here. 33 00:01:39,710 --> 00:01:41,750 Now, when it comes to those links, 34 00:01:41,750 --> 00:01:45,090 we typically render links by using the anchor tag. 35 00:01:45,090 --> 00:01:47,933 That's how we do that in standard HTML. 36 00:01:48,870 --> 00:01:53,020 We could do this here as well but using that link component, 37 00:01:53,020 --> 00:01:57,000 that link element, has one big disadvantage. 38 00:01:57,000 --> 00:01:59,930 If we use a link like this, whenever we click it 39 00:01:59,930 --> 00:02:03,740 a new request will be sent to the server. 40 00:02:03,740 --> 00:02:06,280 The server here is the server hosting 41 00:02:06,280 --> 00:02:09,370 this React application, and indeed that server 42 00:02:09,370 --> 00:02:12,330 would then reply with our application, 43 00:02:12,330 --> 00:02:16,010 and there the router would figure out which page to load. 44 00:02:16,010 --> 00:02:20,730 So a link would work but, we send this request first, 45 00:02:20,730 --> 00:02:22,250 which is redundant. 46 00:02:22,250 --> 00:02:26,290 We already are in our running React application, 47 00:02:26,290 --> 00:02:28,930 and it would be great if we don't leave it 48 00:02:28,930 --> 00:02:31,790 just because we wanna navigate somewhere. 49 00:02:31,790 --> 00:02:33,700 Hence sending that extra request 50 00:02:33,700 --> 00:02:36,850 is not something we necessarily wanna do. 51 00:02:36,850 --> 00:02:39,240 That's why instead of this anchor tag, 52 00:02:39,240 --> 00:02:42,530 we instead use another component provided 53 00:02:42,530 --> 00:02:45,380 by the react-router-dom package. 54 00:02:45,380 --> 00:02:49,140 So we again import from react-router-dom, 55 00:02:49,140 --> 00:02:53,760 and we import the Link component here. 56 00:02:53,760 --> 00:02:57,820 The Link component can be wrapped around our link text 57 00:02:57,820 --> 00:03:01,060 just like the anchor tag, and it will render 58 00:03:01,060 --> 00:03:05,000 a anchor tag in the end but, internally, 59 00:03:05,000 --> 00:03:07,800 react-router-dom attaches a click listener 60 00:03:07,800 --> 00:03:10,250 to the anchor tag, and when you click on it, 61 00:03:10,250 --> 00:03:14,500 it will prevent that browser default of sending a request, 62 00:03:14,500 --> 00:03:19,400 and instead just parse the URL you want to go to, 63 00:03:19,400 --> 00:03:22,010 change it in the browser URL bar, 64 00:03:22,010 --> 00:03:24,090 but then not send the request, 65 00:03:24,090 --> 00:03:28,270 but instead load the appropriate component onto the screen 66 00:03:28,270 --> 00:03:30,930 just with React and JavaScript, 67 00:03:30,930 --> 00:03:33,780 so that we stay on this already loaded page, 68 00:03:33,780 --> 00:03:37,040 and we don't send this extra request. 69 00:03:37,040 --> 00:03:39,253 So that's why we add links like this. 70 00:03:40,150 --> 00:03:42,580 Now, of course, here that should not be some link 71 00:03:42,580 --> 00:03:45,590 but a link to all the meetups let's say. 72 00:03:45,590 --> 00:03:50,590 And to make Link aware of the URL it should navigate to, 73 00:03:50,870 --> 00:03:53,690 we have to set the to prop here. 74 00:03:53,690 --> 00:03:57,950 This is one of the expected props on the link component. 75 00:03:57,950 --> 00:04:02,250 And here we set a path in this case just slash nothing, 76 00:04:02,250 --> 00:04:06,377 because that is the path to the AllMeetupsPage. 77 00:04:08,750 --> 00:04:13,750 Now we can replicate this, and add two more list items, 78 00:04:14,320 --> 00:04:18,160 where the second one leads to /new-meetup 79 00:04:18,160 --> 00:04:22,550 and says new meetup or Add New Meetup, 80 00:04:22,550 --> 00:04:24,260 that's up to you, of course. 81 00:04:24,260 --> 00:04:27,130 And on the last link we go to /favorites 82 00:04:27,130 --> 00:04:32,130 and we say favorites, or My Favorites, something like this. 83 00:04:34,490 --> 00:04:36,530 Now we got those links in place 84 00:04:36,530 --> 00:04:39,160 and we got this main navigation component. 85 00:04:39,160 --> 00:04:42,130 We can now use this in the App.js file, 86 00:04:42,130 --> 00:04:45,450 and there we can now import main navigation 87 00:04:45,450 --> 00:04:50,450 from ./components/layout/MainNavigation 88 00:04:51,110 --> 00:04:54,510 and add this above that Switch statement. 89 00:04:54,510 --> 00:04:59,230 Here we can add MainNavigation as a self-closing tag still, 90 00:04:59,230 --> 00:05:00,303 if we want to. 91 00:05:01,610 --> 00:05:04,430 If we save this, we'll see some navigation here. 92 00:05:04,430 --> 00:05:06,670 And if you click those links, they work. 93 00:05:06,670 --> 00:05:10,420 The styling is missing, but we got working links. 94 00:05:10,420 --> 00:05:12,610 We got a working navigation. 95 00:05:12,610 --> 00:05:14,130 Now I want to add some styling, 96 00:05:14,130 --> 00:05:16,990 and for this, we're going to explore a different way 97 00:05:16,990 --> 00:05:18,993 of styling our components. 7824

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