Skip to content

Instantly share code, notes, and snippets.

@vibegui
Created February 21, 2016 13:05
Show Gist options
  • Select an option

  • Save vibegui/57619b22111c19636a25 to your computer and use it in GitHub Desktop.

Select an option

Save vibegui/57619b22111c19636a25 to your computer and use it in GitHub Desktop.
var CommentList = React.createClass({
render: function() {
var commentNodes = this.props.data.map(function (comment) {
return (
<Comment author={comment.author}>
{comment.text}
</Comment>
);
});
return (
<div className="commentList">
{commentNodes}
</div>
);
}
});
var CommentBox = React.createClass({
render: function() {
return (
<div className="commentBox">
<h1>Comments</h1>
<CommentList data={this.props.data} />
</div>
);
}
});
React.render(
<CommentBox data={data} />,
document.getElementById('content')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment