490 B
490 B
title | localeTitle |
---|---|
Render React on the Server with renderToString | 使用renderToString在服务器上渲染React |
使用renderToString在服务器上渲染React
解:
您将class
传递给.renderToString()
就像将组件传递给render
方法一样。
class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return <div/>
}
};
// change code below this line
ReactDOMServer.renderToString(<App />);