React Server Components support for EreoJS framework
npm install @ereo/rscReact Server Components support for the EreoJS framework. Enables streaming RSC rendering with automatic client/server component detection.
``bash`
bun add @ereo/rsc
`typescript
import { defineConfig } from '@ereo/core';
import { createRSCRenderConfig } from '@ereo/rsc';
export default defineConfig({
render: createRSCRenderConfig({
enabled: true,
}),
});
`
`tsx
// Server Component (default)
async function ProductList() {
const products = await db.products.findMany();
return (
{products.map(p =>
);
}
// Client Component
'use client';
function Counter() {
const [count, setCount] = useState(0);
return ;
}
`
- Streaming Support: Stream RSC payloads for faster initial page loads
- Server Components: Render components on the server with direct data access
- Client Components: Automatic detection and handling of 'use client' directives
- Component Detection: Utilities to check if components are server or client
- RSC Serialization: Serialize component trees for network transport
- Stream Parsing: Parse RSC streams back into component data
- Client References: Automatic extraction of client component references
- TypeScript Support: Full type definitions for RSC configuration
- serializeRSC(component, config) - Serialize a component tree to RSC formatparseRSCStream(stream)
- - Parse an RSC stream back into component dataisServerComponent(component)
- - Check if a component is a server componentisClientComponent(component)
- - Check if a component is a client componentcreateRSCRenderConfig(config)` - Create RSC render configuration
-
For full documentation, visit the EreoJS Documentation.
This package is part of the EreoJS monorepo - a modern full-stack JavaScript framework.
MIT