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
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

Original subtitles

[Maximilian Schwarzmuller] Now let's take care

about adding such a navigation bar to our application.

And for this I'll go to the components folder

and add a new folder in there.

And I'll name it layout, because it will hold

some general layout components.

So a sub-folder inside of components,

and in there I'll add the main navigation.js file,

which is the file that should hold

this main navigation component.

Now I added it here in the components folder

and not in the pages folder

because this component will not be loaded

as a page with help of the router,

but instead we will embed it

in the content of our other code just as we did before.

Totally unrelated to the router.

Now in this main navigation component file,

we can again define our component function,

MainNavigation, and export it as we're used to.

And then of course return some JSX content here.

And here I wanna return a header,

a header component which in the end will then wrap

all the items that should go into this header.

And here I actually wanna have a div first with my logo,

which in this case will just be some text.

I'll name it React Meetups.

And then next to this div, inside of the header,

I'll add a nav element, and here I'll then add

an unordered list with a couple of list items

where all those list items will be the different links

which we have here.

Now, when it comes to those links,

we typically render links by using the anchor tag.

That's how we do that in standard HTML.

We could do this here as well but using that link component,

that link element, has one big disadvantage.

If we use a link like this, whenever we click it

a new request will be sent to the server.

The server here is the server hosting

this React application, and indeed that server

would then reply with our application,

and there the router would figure out which page to load.

So a link would work but, we send this request first,

which is redundant.

We already are in our running React application,

and it would be great if we don't leave it

just because we wanna navigate somewhere.

Hence sending that extra request

is not something we necessarily wanna do.

That's why instead of this anchor tag,

we instead use another component provided

by the react-router-dom package.

So we again import from react-router-dom,

and we import the Link component here.

The Link component can be wrapped around our link text

just like the anchor tag, and it will render

a anchor tag in the end but, internally,

react-router-dom attaches a click listener

to the anchor tag, and when you click on it,

it will prevent that browser default of sending a request,

and instead just parse the URL you want to go to,

change it in the browser URL bar,

but then not send the request,

but instead load the appropriate component onto the screen

just with React and JavaScript,

so that we stay on this already loaded page,

and we don't send this extra request.

So that's why we add links like this.

Now, of course, here that should not be some link

but a link to all the meetups let's say.

And to make Link aware of the URL it should navigate to,

we have to set the to prop here.

This is one of the expected props on the link component.

And here we set a path in this case just slash nothing,

because that is the path to the AllMeetupsPage.

Now we can replicate this, and add two more list items,

where the second one leads to /new-meetup

and says new meetup or Add New Meetup,

that's up to you, of course.

And on the last link we go to /favorites

and we say favorites, or My Favorites, something like this.

Now we got those links in place

and we got this main navigation component.

We can now use this in the App.js file,

and there we can now import main navigation

from ./components/layout/MainNavigation

and add this above that Switch statement.

Here we can add MainNavigation as a self-closing tag still,

if we want to.

If we save this, we'll see some navigation here.

And if you click those links, they work.

The styling is missing, but we got working links.

We got a working navigation.

Now I want to add some styling,

and for this, we're going to explore a different way

of styling our components.

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