Dec 14, 2019 in React JS
Q: ReactDOMServer renderToStaticNodeStream()

1 Answer

0 votes
Dec 14, 2019

Similar to renderToNodeStream, except this doesn’t create extra DOM attributes that React uses internally, such as data-reactroot. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save some bytes.

The HTML output by this stream is exactly equal to what ReactDOMServer.renderToStaticMarkup would return.

If you plan to use React on the client to make the markup interactive, do not use this method. Instead, use renderToNodeStream on the server and ReactDOM.hydrate() on the client.


Server-only. This API is not available in the browser.

The stream returned from this method will return a byte stream encoded in utf-8. If you need a stream in another encoding, take a look at a project like iconv-lite, which provides transform streams for transcoding text.

Click here to read more about React JS
Click here to read more about Insurance

Related questions

0 votes
Feb 23 in React JS
  • #reactdomserver
  • reactserver
  • reactdom
  • dom-package
0 votes
Dec 14, 2019 in React JS