ReactDOMServer
ReactDOMServer
If you load React from a <script>
tag, these top-level APIs are available on the ReactDOMServer
global. If you use ES6 with npm, you can write import ReactDOMServer from 'react-dom/server'
. If you use ES5 with npm, you can write var ReactDOMServer = require('react-dom/server')
.
Overview
The ReactDOMServer
class allows you to render your components on the server.
Reference
renderToString()
ReactDOMServer.renderToString(element)
Render a React element to its initial HTML. This should only be used on the server. React will return an HTML string. You can use this method to generate HTML on