Skip to content

Commit cb29e15

Browse files
committed
Composing components
1 parent 3203ec0 commit cb29e15

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

public/scripts/example.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,40 @@
1010
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1111
*/
1212

13+
14+
1315
var CommentBox = React.createClass({
1416
render: function() {
1517
return (
1618
<div className="commentBox">
17-
Hello, world! I am a CommentBox.
19+
<h1>Comments</h1>
20+
<CommentList />
21+
<CommentForm />
22+
</div>
23+
);
24+
}
25+
});
26+
27+
var CommentList = React.createClass({
28+
render: function() {
29+
return (
30+
<div className="commentList">
31+
Hello, world! I am a CommentList.
1832
</div>
1933
);
2034
}
2135
});
36+
37+
var CommentForm = React.createClass({
38+
render: function() {
39+
return (
40+
<div className="commentForm">
41+
Hello, world! I am a CommentForm.
42+
</div>
43+
);
44+
}
45+
});
46+
2247
ReactDOM.render(
2348
<CommentBox />,
2449
document.getElementById('content')

0 commit comments

Comments
 (0)