This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ReactDOMServer = require('react-dom/server'); | |
const render = (reactComponent) => { | |
return new Promise((resolve, reject) => { | |
const body = []; | |
const bodyStream = ReactDOMServer.renderToNodeStream(reactComponent); | |
bodyStream.on('data', (chunk) => { | |
body.push(chunk.toString()); | |
}); | |
bodyStream.on('error', (err) => { |