Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

How to use Next.js metadata if the page is a client component

91,579 Aufrufe • vor 2 Jahren •via X (Twitter)

10 Kommentare

Profilbild von Alex Sidorenko
Alex Sidorenkovor 2 Jahren

This is a quick fix for when you are refactoring your codebase to the App Router and want to quickly add metadata to existing pages with interactivity. But ideally, it's better to isolate interactive bits closer to where they're needed.

Profilbild von Guillermo Rauch
Guillermo Rauchvor 2 Jahren

Love that page.client convention. Clean

Profilbild von Alex Sidorenko
Alex Sidorenkovor 2 Jahren

Yes! It's from the Next Discord FAQ. Props to Vũ Văn Dũng (not sure what's the right X handle)

Profilbild von عَ
عَvor 2 Jahren

Can I do the same thing to call server actions or get cookie information ? 🤔

Profilbild von Alex Sidorenko
Alex Sidorenkovor 2 Jahren

Server Actions are designed to be used in client components.

Profilbild von Moti Azu
Moti Azuvor 2 Jahren

You literally made the page not a client component. I like the naming convention you used though. But you didn’t use metadata in a client component.

Profilbild von Ajin
Ajinvor 2 Jahren

cool

Profilbild von Benzigar Alvin.
Benzigar Alvin.vor 2 Jahren

nice idea, wrapping client component inside server component. 👍🏻

Profilbild von rayyan ✦ design engineer
rayyan ✦ design engineervor 2 Jahren

i never think of it this way, thanks man

Profilbild von Subhajit Bhar
Subhajit Bharvor 2 Jahren

I'm learning next.js. this is very useful for me. Thanks for sharing 🙏🏼

Ähnliche Videos