Files

29 lines
520 B
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Render React on the Server with renderToString
---
# Render React on the Server with renderToString
2018-10-12 15:37:13 -04:00
---
## Solutions
2018-10-12 15:37:13 -04:00
You pass a ```class``` to ```.renderToString()``` just like you would pass a component to a ```render``` method.
<details><summary>Solution 1 (Click to Show/Hide)</summary>
2018-10-12 15:37:13 -04:00
```jsx
class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return <div/>
}
};
// change code below this line
ReactDOMServer.renderToString(<App />);
```
</details>