Rendering components

suggest change

There are two options for rendering components on the server: renderToString and renderToStaticMarkup.

renderToString

This renders React components to HTML on the server. In React 15 it also adds data-reactid markers so client React can hydrate the markup instead of creating those elements again.

import { renderToString } from "react-dom/server";
renderToString(<App />);

renderToStaticMarkup

This renders React components to HTML without the React 15 hydration markers. Do not use it for markup that client React will hydrate, because the client cannot reuse that HTML and will render the tree again.

import { renderToStaticMarkup } from "react-dom/server";
renderToStaticMarkup(<App />);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents