tutorial.js 902 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. let Comment = React.createClass({
  2. render: function () {
  3. return (
  4. <div className="comment">
  5. <h2 className="commentAuthor">
  6. {this.props.author}
  7. </h2>
  8. {this.props.children}
  9. </div>
  10. );
  11. }
  12. });
  13. let CommentList = React.createClass({
  14. render: function () {
  15. return (
  16. <div className="commentList">
  17. Hello, world! I am a CommentList.
  18. </div>
  19. );
  20. }
  21. });
  22. let CommentForm = React.createClass({
  23. render: function () {
  24. return (
  25. <div className="commentForm">
  26. Hello, world! I am a CommentForm.
  27. </div>
  28. );
  29. }
  30. });
  31. let CommentBox = React.createClass({
  32. render: function () {
  33. return (
  34. <div className="commentBox">
  35. <h1>Comments</h1>
  36. <CommentList />
  37. <CommentForm />
  38. </div>
  39. );
  40. }
  41. });
  42. ReactDOM.render(
  43. <CommentBox />,
  44. document.getElementById("content")
  45. );