Explorar o código

Listing 4: using props.

Frederic G. MARAND %!s(int64=8) %!d(string=hai) anos
pai
achega
c5ef09183f
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      public/scripts/tutorial.js

+ 13 - 0
public/scripts/tutorial.js

@@ -1,3 +1,16 @@
+let Comment = React.createClass({
+  render: function () {
+    return (
+      <div className="comment">
+        <h2 className="commentAuthor">
+          {this.props.author}
+        </h2>
+        {this.props.children}
+      </div>
+    );
+  }
+});
+
 let CommentList = React.createClass({
   render: function () {
     return (