Files
2018-10-16 21:32:40 +05:30

490 B

title, localeTitle
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 />);