Skip to content
Hill Liu edited this page Feb 27, 2016 · 13 revisions

Explain how to render CSS style in server side.

  1. In server side you could render css style directly.

  2. And for react-dom you could use renderToString and use a special flag to split normal output and react-dom.

    • Such as
var tmp = ReactServer.renderToString(MyApp(
    myJson 
));
console.log('<!--start-->'+tmp);
  1. So for finial rendering, you could split two type content (html & css style), then react will not complain client and server have different output anymore.