Server and client pages in the same app #33
-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I think you would need to update your ssr.jsx file to conditionally exclude the specific components you want to render client side only. |
Beta Was this translation helpful? Give feedback.
-
But when is not server render the problem is that ssr.tsx is not invoked at all no? |
Beta Was this translation helpful? Give feedback.
-
Great question @andresgutgon! The way I handle selectively applying SSR in my apps is to assign an conn
|> assign_prop(:ssr, true)
|> render_inertia("MyPage", ssr: true) createInertiaApp({
resolve: async (name) => {
return await import(`./pages/${name}.jsx`);
},
setup({ App, el, props }) {
if (props.initialPage.props.ssr) {
hydrateRoot(el, <App {...props} />);
} else {
createRoot(el).render(<App {...props} />);
}
},
}); Your |
Beta Was this translation helpful? Give feedback.
Great question @andresgutgon! The way I handle selectively applying SSR in my apps is to assign an
ssr
page prop (in addition to thessr: true
option passed torender_inertia
), so that mycreateInertiaApp
setup function can key off of that when applicable.Your
ssr.jsx
(orssr.tsx
) file can stay the same.