Skip to content
Merged
Changes from all 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
50 changes: 1 addition & 49 deletions packages/plugin-rsc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ npx degit vitejs/vite-plugin-react/packages/plugin-rsc/examples/starter my-app

## Examples

**Start here:** [`./examples/starter`](./examples/starter) - Recommended for understanding the plugin
**Start here:** [`./examples/starter`](./examples/starter) - Recommended for understanding the package

- Provides an in-depth overview of API with inline comments to explain how they function within RSC-powered React application.

Expand Down Expand Up @@ -295,35 +295,6 @@ export function UserApp() {
}
```

#### `<id>?vite-rsc-css-export=<name>`

This special query convention provides automatic injection of `import.meta.viteRsc.loadCss`.

For example,

```tsx
// my-route.tsx
export function Page(props) {
return <div>...</div>
}

// my-route.tsx?vite-rsc-css-export=Page
function Page(props) {
return <div>...</div>
}

function __Page(props) {
return (
<>
{import.meta.viteRsc.loadCss()}
<Page {...props} />
</>
)
}

export { __Page as Page }
```

### Available on `ssr` environment

#### `import.meta.viteRsc.loadBootstrapScriptContent("index")`
Expand Down Expand Up @@ -434,25 +405,6 @@ This module re-exports RSC runtime API provided by `react-server-dom/client.brow
- `createFromFetch`: a robust way of `createFromReadableStream((await fetch("...")).body)`
- `encodeReply/setServerCallback`: server function related...

## High level API

> [!NOTE]
> High level API is deprecated. Please write on your own `@vitejs/plugin-rsc/{rsc,ssr,browser}` integration.

This is a wrapper of `react-server-dom` API and helper API to setup a minimal RSC app without writing own framework code like [`./examples/starter/src/framework`](./examples/starter/src/framework/). See [`./examples/basic`](./examples/basic/) for how this API is used.

### `@vitejs/plugin-rsc/extra/rsc`

- `renderRequest`

### `@vitejs/plugin-rsc/extra/ssr`

- `renderHtml`

### `@vitejs/plugin-rsc/extra/browser`

- `hydrate`

## CSS Support

The plugin automatically handles CSS code-splitting and injection for server components. This eliminates the need to manually call [`import.meta.viteRsc.loadCss()`](#importmetaviterscloadcss) in most cases.
Expand Down
Loading