ReactDOMServer APIs

Under Construction

This section is incomplete, please see the old docs for ReactDOM.

The ReactDOMServer APIs let you render React components to HTML.

Typically, you will run ReactDOMServer on the server to generate your app’s initial HTML. You will either use it directly or a framework may do it for you. Most of your components should not need to import this module.

Installation

Terminal
npm install react-dom
// Importing a specific API:
import { renderToPipeableStream } from 'react-dom/server';

// Importing all APIs together:
import * as ReactDOMServer from 'react-dom/server';

You’ll also need to install the same version of React.

Exports

renderToPipeableStream

Render a React element to a pipeable stream.

renderToPipeableStream(element, options)

renderToReadableStream

Render a React element to a Readable stream.

renderToReadableStream(element, options)

renderToNodeStream

Render a React element to a Node stream.

renderToNodeStream(element)

renderToStaticNodeStream

Render a React element to a static Node stream.

renderToStaticNodeStream(element)

renderToString

Render a React element to a string.

renderToString(element)

renderToStaticMarkup

Render a React element to static markup.

renderToStaticMarkup(element)