react 如何组合
例如现在有Button和 Nav两个类
能不能实现这样
var Button, Nav; //实现省略
React.render(
<Nav>
<Button></Button>
</Nav>
, docuememt.getElementById('div'))
这样 Nav类该怎么写
deoxys
9 years, 8 months ago
Answers
Nav.jsx
var Nav = React.createClass({
render: function() {
return (
<div className="commentBox">
Hello, world! I am a CommentBox.
{ this.props.children }
</div>
);
}
});
index.jsx
React.render(
<Nav>
<button>BUTTON</button>
</Nav>,
document.getElementById('div')
);
看 plunker
游戏X黑魔导
answered 9 years, 8 months ago