2.1.0 • Published 1 year ago

react-render-to-string v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-render-to-string

Like renderToStaticMarkup but with suspense support.

The module is intended to be used with static site generators that support data fetching inside components rather than upfront.

It internally uses renderToReadableStream and captures the result as string.

Node.js vs. other runtimes

The package exports two different implementations, one for modern environments that support Web Streams, and one that uses renderToPipeableStream instead.

Note: Node.js supports Web Streams since v.16.5.0, but the exports map of react-dom/server specifies a special build for "node" that does not include renderToReadableStream. Therefore, this package does the same and falls back to renderToPipeableStream.

Usage

import renderToString from "react-render-to-string";
import { App } from "./App";

const html = await renderToString(<App />);
2.1.0

1 year ago

2.0.0

2 years ago

1.1.0-next.1

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.0-next.2

2 years ago

1.0.0-next.1

2 years ago