我是reactjs的新手..
我正在尝试使用 renderToStaticMarkup 渲染组件(jsx),但出现以下错误:
错误:
Invariant Violation: Invalid tag: <html data-reactroot="" data-reactid="1" data-re....
server.js(片段)
var html = ReactDOMServer.renderToStaticMarkup(
React.createElement(
ReactDOMServer.renderToString(Component(props))
),
script({dangerouslySetInnerHTML: {__html:
'var APP_PROP = ' + safeStringify(props) + ';'
}}),
script({src: '//cdnjs.cloudflare.com/ajax/libs/react/15.3.0/react.min.js'}),
script({src: '//cdnjs.cloudflare.com/ajax/libs/react/15.3.0/react-dom.min.js'}),
script({src: '/bundle.js'})
)
response.send(html)
}
组件.jsx
return(
<html>
<head></head>
<body>
<div>
<ul>{values}</ul>
<button onClick={this.handleClick}>Click Me!</button>
</div>
</body>
</html>
);
}