结构:
第一层——CommentBox
第二层——CommentList
第三层——Comment
第二层——CommentForm
1、JSX语法:
var CommentBox = React.createClass({
render: function() {
return (
<div className="commentBox">
CommentBox
</div>
);
}
});
ReactDOM.render(
<CommentBox />,
document.getElementById('commentBox')
);
JSX是XML式的语法,预编译器会将语法糖转换成单纯的JavaScript:
var CommentBox = React.createClass({
displayName: 'CommentBox'