All language subtitles for 001 Share Link Button_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
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
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

In this section we'll take a deeper

look at Client Components.

So far everything in our pages is fully static.

The only interactivity is that users

can navigate to different pages,

and that does use client-side navigation,

but it's all managed by Next.js automatically.

Now, let's say we'd like to

add a button to this page

to make it easier for our users

to share a link to this review.

Many websites show a Share link

button on each article.

This one is just an example of

a blog hosted on Substack.

Users can click this Share button,

and this shows various options.

One of them is "Copy link",

that simply copies the page URL to the clipboard.

So maybe we could add something

like this to our own website.

Let's go and create a new component

for this functionality.

Under "components" we can add a file,

let's call it "ShareLinkButton.jsx".

And in this file we'll export

a regular function component,

again called ShareLinkButton.

Let's start by returning a

simple "button" element,

with "Share link" as the text.

Ok, we can save this,

and go and use it in our ReviewPage component.

We could add it after the date.

Let's insert the ShareLinkButton here.

And if we save,

this is our new button.

It could do with some styling.

Let's add some CSS classes,

like a "border", and some padding around the text.

We could also make it "rounded",

set the "text" color to "slate-500",

and finally use a small font.

Ok, it now looks more like an outlined button.

If we move the mouse over it,

we'll want to give the user some visual feedback.

On hover, let's change the background color

to a darker shade of orange,

and in that case we could also make the text darker,

to compensate.

Let's see what it looks like now.

That's ok.

Now, we could display the button next to the date.

So, let me add a "div" here,

wrapping both the date and the ShareLinkButton.

This way we can style the container

div to use "flex",

with a "gap" between the children.

You can see in the browser that

the date and the button are now on the same row.

But the text is not properly aligned.

We can fix that by adding "items-baseline".

Ok, that's better.

We're now ready to add some actual functionality,

that is, do something if the

user clicks the button.

Let's set an "onClick" handler

and we'll write a separate "handleClick function.

Let's go and do that now:

define "handleClick" as an arrow function,

and for a start we can just log a message,

saying "clicked!"

This is a basic event handler in React.

But if we save,

we get an "Unhandled Runtime Error".

The message says: "If you need interactivity,"

"consider converting part of

this to a Client Component".

If you remember, we've already seen

this in the section on Rendering.

With Next.js and the App Router,

all our components are Server

Components by default.

To use any client-side functionality,

we need a Client Component instead.

We'll see exactly how Client Components

work in the next video.

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