How to use Next.js metadata if the page is a client component
@asidorenko_35K followers
91,579 views
10 Comments
Comments from the original post on X (Twitter)

@asidorenko_
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.
28 likes

@rauchg
Love that page.client convention. Clean
59 likes

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

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

@asidorenko_
Server Actions are designed to be used in client components.
1 like

@MotiAzu
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.
2 likes

@ChandyAjin
cool
2 likes

@benzigar_alvin
nice idea, wrapping client component inside server component. 👍🏻
1 like

@rayyanekaputra
i never think of it this way, thanks man
1 like

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