Server side rendering only on first request #12194
-
I would like to use SSR only on first request for SEO purposes and would like to avoid backend for frontend (loaders) usage on navigation. Basically I would like to disable loaders after first request aka switch to SPA after first SSR. Is it possible to do somehow? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In Remix v2, by adding a client loader to a route (https://remix.run/docs/en/main/route/client-loader), the server loader is only called if you explicitly call it, so you can simply not call the server if you prefer. That's how it will work in React Router v7 too. Not sure how it currently works in React Router v6 though. |
Beta Was this translation helpful? Give feedback.
In Remix v2, by adding a client loader to a route (https://remix.run/docs/en/main/route/client-loader), the server loader is only called if you explicitly call it, so you can simply not call the server if you prefer. That's how it will work in React Router v7 too. Not sure how it currently works in React Router v6 though.