How to use React.Component with renderToString method?
问题 I tried to do the server side render using renderToString method. function handleRender(req, res) { const html = renderToString( <Counter /> ); res.send(renderFullPage(html)); } function renderFullPage(html) { return ` <!doctype html> <html> <head> <title>React Universal Example</title> </head> <body> <div id="app">${html}</div> <script src="/static/bundle.js"></script> </body> </html> ` } If the component like following it works: Counter.js const Counter = () => { function testClick(){