我有一个react组件管理整个应用程序.看起来像:
var Page = React.createClass({ displayName: 'Page', render: function() { return ( React.DOM.div(null /*, stuff here ..*/ ) ); } });
和HTML看起来像
我把它渲染成:
React.renderComponent(Page(null), document.getElementById('content'));
但相反,我想做出反应来管理整个body
标记,因此没有冗余的嵌套div
.我怎么能渲染这样的东西?
我不完全确定这是不是你要问的,但你可以跑
React.renderComponent(Page(null), document.body);
将组件直接安装到主体中.