Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kuechenplaner's avatar

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?

0 likes
3 replies
gych's avatar

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.

kuechenplaner's avatar

@gych what do you mean with client side hydration? I activate SSR and put event handlers to lifecycle hooks, that's all? Or are there more steps?

gych's avatar
gych
Best Answer
Level 29

@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.