@aklesky/streamable-react
v0.6.7
Published
React Server Side Streamable Rendering
Downloads
18
Maintainers
Readme
Easy React streaming wrap functionality (Node.js Stream)
Installation
- npm
npm i @aklesky/streamable-react
- yarn
yarn add @aklesky/streamable-react
Configuration
Static options & usage
import { useRenderToPipeableStream } from '@aklesky/streamable-react/pipeable/render.js'
const render = useRenderToPipeableStream({
component: React.ComponentType
timeout: number, // default 10000,
identifierPrefix: options.identifierPrefix,
namespaceURI: options.namespaceURI,
nonce: options.nonce,
progressiveChunkSize: options.progressiveChunkSize,
bootstrapModules: options.bootstrapModules,
bootstrapScripts: options.bootstrapScripts,
})
Streamable Options within http middleware
await render(http.ServerResponse, {
component: React.ComponentType,
props: {},
onTimeoutEventHandler: options.onTimeoutEventHandler?.(req, res),
onAllReadyHandler: options.onAllReadyHandler?.(req, res),
onErrorHandler: options.onErrorHandler?.(req, res),
onFinishEventHandler: options.onFinishEventHandler?.(req, res),
onShellErrorHandler: options.onShellErrorHandler?.(req, res),
onShellReadyHandler: options.onShellReadyHandler?.(req, res),
})
Supported Versions
| Name | Version | Supported | | ---------- | ---------- | ------------------ | | React | >= 18.2.0 | :white_check_mark: |