How to render React on the server?

The challenge is to get the html on the server-side components React.

Faltered with babel.
In General, in all examples, all the templates are written without quotation marks. I have the same error. I understand the need babel.
var code = 'export default React.createClass({
 getInitialState() {
 return { num: this.getRandomNumber() };

 getRandomNumber(): number {
 return Math.ceil(Math.random() * 6);

 render(): any {
 return <div>
 Your dice roll:

var qwerty = babel.transform(code, {
 presets: [

Get a huge amount of data. I need a clean html that will be output.
I don't need it to output to the browser. Task is to save the html to a file.
June 14th 19 at 20:23
2 answers
June 14th 19 at 20:25
It is strongly recommend to improve skills gugleniya.
You are confusing something. Babel compiles to js or in the case of react's jsx. Nothing babel has to render components. First, learn how to build the project, then to run, and then render on the server. For this renderToString there are methods that will return the correct markup to react or renderToStaticMarkup who will return to the normal layout.

Guys with knowledge and rollup saga why not answer? - lester_Sta commented on June 14th 19 at 20:28
June 14th 19 at 20:27
not really... - lester_Sta commented on June 14th 19 at 20:30

Find more questions by tags npmNode.jsJavaScriptReact