React server rendering --> Replacing React-rendered children with a new root component

时光总嘲笑我的痴心妄想 提交于 2019-12-05 20:42:14

Use renderToStaticMarkup

// render the dynamic code of the page to a string.
var appHtml = React.renderToString(<Application/>);

// now use React as a static templating language to create the <html>, 
// <head>, and <body> tags
var fullPageHtml = React.renderToStaticMarkup(<HtmlPage content={appHtml}/>);

res.write(fullPageHtml); 

Full Issue resolution discussion can be found here. https://github.com/aickin/react-dom-stream/issues/4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!