Created
February 21, 2016 13:05
-
-
Save vibegui/57619b22111c19636a25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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