Migration

renderToNodeStream migration

React 19 removes this legacy server API. For progressive Node.js HTML delivery use renderToPipeableStream. It exposes pipe and abort rather than returning a normal Readable. A hosting adapter must handle status, shell errors, disconnect and timeout. This local example writes only to an injected stream, not a live server.

Formal Syntax & Structure

react syntaxreact
renderToPipeableStream(element, options)

Working Example

Example Snippetreact
import { renderToPipeableStream } from 'react-dom/server';export function renderReport(destination) {  const {pipe,abort} = renderToPipeableStream(<main>Inventory report</main>, {    onShellReady() { pipe(destination); },    onShellError(error) { destination.destroy(error); }  });  return abort; // Caller owns timeout and disconnect cleanup.}
React Reference