jsx.txt 394 B

123456789101112131415161718192021
  1. var X = React.createClass({
  2. render: function() {
  3. var c = this.map(c => <Comment comment={c} key={c.id} />);
  4. return (
  5. <div className='comments'>
  6. {c}
  7. </div>
  8. );
  9. },
  10. foo: function() {}
  11. });
  12. var Comment = React.createClass({
  13. render: function() {
  14. var comment = this.props.comment;
  15. return (
  16. <li>{comment}</li>
  17. );
  18. }
  19. foo: function() {}
  20. });