Client Side Functionality?
Hey all,
I'm aware that client side rendering is a thing with
use client
(or a handful of other ways), but I'm curious if client side functionality is a thing.
For example, a button that does a client-side action: The rendering of the button doesn't require any client side features, but the 'onClick' method does. Is there a way to SSR the button, and associate it with some functionality client-side?
This is just a curiosity question; I don't actually need this for a project haha2 Replies
Pretty sure it already does that in Next. Components will get pre-rendered on the server then the javascript will be hydrated after
https://nextjs.org/docs/getting-started/react-essentials#the-use-client-directive
Getting Started: React Essentials
An overview of essential React features for building Next.js Applications, including Server Components.
You got it backwards.
use client
= client side functionality not client side rendering. Components with use client
will still be server side rendered if you want them to be.