04 / 05

Discuss react-dom/server and apis available on it.

The react-dom/server APIs let you server-side render React components to HTML. These APIs are only used on the server at the top level of your app to generate the initial HTML. A framework may call them for you. Most of your components don’t need to import or use them.

Server APIs for Node.js Streams
  1. 1

    renderToPipeableStream renders a React tree to a pipeable Node.js Stream.

  2. 2

    These methods are only available in the environments with Node.js Streams:

Server APIs for Web Streams
  1. 1

    renderToReadableStream renders a React tree to a Readable Web Stream.

  2. 2

    These methods are only available in the environments with Web Streams, which includes browsers, Deno, and some modern edge runtimes:

Legacy Server APIs for non-streaming environments
  1. 1

    renderToString renders a React tree to a string.

  2. 2

    renderToStaticMarkup renders a non-interactive React tree to a string.

  3. 3

    These methods can be used in the environments that don’t support streams

  4. 4

    They have limited functionality compared to the streaming APIs.