Skip to content

Server-side rendering

React Router can be used as either a routing library or a full-stack framework, incorporating the entire functionality of Remix.

Install the React Router framework by running npm create vite. “React Router v7” is available as one of the options under React Vite templates. Selecting this option will redirect you to the React Router framework CLI to complete the installation.

Terminal window
bunx create-react-router@latest react-router-ssr

This will create a folder with whatever you named your project. Change into that directory, then start the development server of the application:

Terminal window
cd react-router-ssr
bun run dev

After that, open your browser and visit the URL http://localhost:5173.

In order to use React Router v7 for SSR, make sure ssr is set to true in the React Router configuration file. It is set to true by default. Open the react-router.config.ts file in your code editor to confirm:

Server-side rendering with React Router v7


El contingut d'aquest lloc web té llicència CC BY-NC-ND 4.0.

©2022-2025 xtec.dev