Thereact-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. Aframework may call them for you. Most of your components don’t need to import or use them.
Server APIs for Web Streams
These methods are only available in the environments withWeb Streams, which includes browsers, Deno, and some modern edge runtimes:
renderToReadableStreamrenders a React tree to aReadable Web Stream.resumeresumesprerenderto aReadable Web Stream.
Note
Node.js also includes these methods for compatibility, but they are not recommended due to worse performance. Use thededicated Node.js APIs instead.
Server APIs for Node.js Streams
These methods are only available in the environments withNode.js Streams:
renderToPipeableStreamrenders a React tree to a pipeableNode.js Stream.resumeToPipeableStreamresumesprerenderToNodeStreamto a pipeableNode.js Stream.
Legacy Server APIs for non-streaming environments
These methods can be used in the environments that don’t support streams:
renderToStringrenders a React tree to a string.renderToStaticMarkuprenders a non-interactive React tree to a string.
They have limited functionality compared to the streaming APIs.