Next.js Discord

Discord Forum

Interactability on SSR Components

Answered
Oak shoot sawfly posted this in #help-forum
Open in Discord
Avatar
Oak shoot sawflyOP
Hey, I'm currently starting up a project with next.js and am utilizing SSR since SEO is important to me, however, I'm wondering what is the best way (if there is a best way) to add interactability to server rendered html. A simple case would be wanting to add an onclick event to the title of a page. I want the title to be server-rendered but I also want to add an onclick to it to say display a popup when it's clicked.

Outside of next.js this seems simple by simply having JS run after the html is rendered so you get the benefit of the text being including in the html but also can add interactability to it on the client-end. I've seen the clear separation of server components and client components but am unsure of where to look for info on the hybrid.

Any help is appreciated!
Answered by Arinji
seo still exists for client components, nextjs renders both on the server and just hydrates client components. You can use a client component... no worries
View full answer

3 Replies

Avatar
seo still exists for client components, nextjs renders both on the server and just hydrates client components. You can use a client component... no worries
Answer
Avatar
@Oak shoot sawfly
Avatar
Oak shoot sawflyOP
beautiful 🙂 Appreciate the insight!