Skip to content

Commit 8261b4b

Browse files
committed
docs: tweak
1 parent 83a8f00 commit 8261b4b

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

packages/plugin-rsc/README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,9 @@ This is a wrapper of `react-server-dom` API and helper API to setup a minimal RS
441441

442442
## CSS Support
443443

444-
### How Auto CSS Injection Works
444+
The plugin automatically handles CSS code-splitting and injection for React server components. This eliminates the need to manually call `import.meta.viteRsc.loadCss()` in most cases.
445445

446-
The plugin automatically handles CSS code-splitting and injection for React components. This eliminates the need to manually call `import.meta.viteRsc.loadCss()` in most cases.
447-
448-
1. **Component Detection**: The plugin automatically detects React components by looking for:
446+
1. **Component Detection**: The plugin automatically detects React server components by looking for:
449447
- Function exports with capital letter names (e.g., `export function Page() {}`)
450448
- Default exports that are functions with capital names (e.g., `export default function Page() {}`)
451449
- Const exports assigned to functions with capital names (e.g., `export const Page = () => {}`)
@@ -466,21 +464,19 @@ export function Page() {
466464
```tsx
467465
// After transformation
468466
import './styles.css'
469-
import React from 'react'
470467

471-
export function Page() {
468+
function Page() {
472469
return <div>Hello</div>
473470
}
474471

475472
function __wrapper(props) {
476-
return React.createElement(
477-
React.Fragment,
478-
null,
479-
import.meta.viteRsc.loadCss(),
480-
React.createElement(Page, props),
473+
return (
474+
<>
475+
{import.meta.viteRsc.loadCss()}
476+
<Page {...props} />
477+
</>
481478
)
482479
}
483-
Object.defineProperty(__wrapper, 'name', { value: 'Page' })
484480
export { __wrapper as Page }
485481
```
486482

0 commit comments

Comments
 (0)