Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 68 additions & 17 deletions packages/plugin-rsc/examples/react-router/README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,85 @@
# rsc react-router
# Welcome to React Router! (Experimental RSC)

https://vite-rsc-react-router.hiro18181.workers.dev
⚠️ **EXPERIMENTAL**: This template demonstrates React Server Components with React Router. This is experimental technology and not recommended for production use.

A modern template for exploring React Server Components (RSC) with React Router, powered by Vite.

> [!NOTE]
> React Router now provides [official RSC support](https://reactrouter.com/how-to/react-server-components) for Vite. The example might not be kept up to date with the latest version. Please refer to React Router's official documentation for the latest integrations.
> React Router now provides [official RSC support](https://reactrouter.com/how-to/react-server-components) for Vite. This example is updated to match the latest official template from @remix-run/react-router-templates.

## Features

Vite RSC example based on demo made by React router team with Parcel:
- 🧪 **Experimental React Server Components**
- 🚀 Server-side rendering with RSC
- ⚡️ Hot Module Replacement (HMR)
- 📦 Asset bundling and optimization with Vite
- 🔄 Data loading and mutations
- 🔒 TypeScript by default
- 🎉 TailwindCSS for styling
- 📖 [React Router docs](https://reactrouter.com/)
- 📚 [React Server Components guide](https://reactrouter.com/how-to/react-server-components)

- https://github.com/jacob-ebey/parcel-plugin-react-router/
- https://github.com/jacob-ebey/experimental-parcel-react-router-starter
- https://github.com/remix-run/react-router/tree/rsc/playground/rsc-vite
## Getting Started

See also [`rsc-movies`](https://github.com/hi-ogawa/rsc-movies/).
### Installation

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc/examples/react-router?file=src%2Froutes%2Froot.tsx)
Install the dependencies:

```bash
npm install
```

Or try it locally by:
### Development

```sh
npx giget gh:vitejs/vite-plugin-react/packages/plugin-rsc/examples/react-router my-app
cd my-app
npm i
Start the development server with HMR:

```bash
npm run dev
```

Your application will be available at `http://localhost:5173`.

## Building for Production

Create a production build:

```bash
npm run build
npm run preview
```

## Running Production Build

Run the production server:

# run on @cloudflare/vite-plugin and deploy.
# a separate configuration is found in ./cf/vite.config.ts
```bash
npm start
```

## Understanding React Server Components

This template includes three entry points:

- **`entry.rsc.tsx`** - React Server Components entry point
- **`entry.ssr.tsx`** - Server-side rendering entry point
- **`entry.browser.tsx`** - Client-side hydration entry point

Learn more about React Server Components with React Router in our [comprehensive guide](https://reactrouter.com/how-to/react-server-components).

## Styling

This template comes with [Tailwind CSS](https://tailwindcss.com/) already configured for a simple default starting experience. You can use whatever CSS framework you prefer.

## CloudFlare Support

CloudFlare specific configurations are available in the `cf/` directory:

```bash
npm run cf-dev
npm run cf-build
npm run cf-preview
npm run cf-release
```

---

Built with ❤️ using React Router.
150 changes: 0 additions & 150 deletions packages/plugin-rsc/examples/react-router/app/paper.css

This file was deleted.

56 changes: 0 additions & 56 deletions packages/plugin-rsc/examples/react-router/app/root.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions packages/plugin-rsc/examples/react-router/app/routes.ts

This file was deleted.

20 changes: 0 additions & 20 deletions packages/plugin-rsc/examples/react-router/app/routes/about.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions packages/plugin-rsc/examples/react-router/app/routes/client.tsx

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions packages/plugin-rsc/examples/react-router/app/routes/home.css

This file was deleted.

Loading