Event handlers won't work with SSR, you can still use them but you'll have to add them in the VueJs
onMounted lifecycle hook. SSR can be used with Client Side Hydration to let these work.
Inertiajs SSR how does it work?
Hello,
I have a vue js + inertiajs + laravel website and I need SSR for better seo. In next js I have server and client components and I can't have things like event handlers in the server components.
How does it work in inertia.js? Can I use event handlers, etc when I use SSR? Or will my Web app work as before when I activate SSR?
@kuechenplaner Yes you put the event listeners in the lifecycle hook. Client Side Hydration takes over the SSR rendered page and hydrates it and allows the client side js to work.
If you scroll a bit down on this page you can view instruction on how to enable client side hydration https://inertiajs.com/server-side-rendering
To enable client-side hydration in a Vue 3 app, update your app.js file to use createSSRApp instead of createApp:
Please or to participate in this conversation.