Replace use client with Client-Only wrapper (like Nuxt <ClientOnly>) #87296
ArtaZanjani
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
Currently in Next.js, any component using client-side interactivity must have use client at the top of the file.
• Forces the entire component to render on the client.
• For pages with mostly SSR content, this is inefficient and often requires extra files for small interactive elements (like a single button).
In Nuxt.js, allows wrapping only the interactive part, keeping the rest SSR.
Proposal
• Introduce a Client-Only wrapper or directive for Next.js, similar to Nuxt’s .
• Example: a page is mostly SSR but has one interactive button. Instead of creating a new file or marking the whole page use client, wrap just the button in .
Benefits:
• SSR maintained for non-interactive parts.
• Less boilerplate, fewer extra files.
• Cleaner, maintainable pages combining SSR + client-side interactivity.
Beta Was this translation helpful? Give feedback.
All reactions