diff --git a/public/index.html b/public/index.html index c6220169..891614c8 100644 --- a/public/index.html +++ b/public/index.html @@ -11,6 +11,8 @@
- + + + diff --git a/public/scripts/test1.js b/public/scripts/test1.js new file mode 100644 index 00000000..e5611358 --- /dev/null +++ b/public/scripts/test1.js @@ -0,0 +1,16 @@ +var CommentBox = React.createClass({ + render : function () { + return ( +
+ "Hello, world! I am a CommentBox." +
+ ) + } +}); + +React.render( + , + document.getElementById('content') +); + +// 组件名第一个单词大写 diff --git a/public/scripts/test2.js b/public/scripts/test2.js new file mode 100644 index 00000000..e62e1bba --- /dev/null +++ b/public/scripts/test2.js @@ -0,0 +1,20 @@ +var CommentList = React.createClass({ + render : function () { + return ( +
+ hello I am a CommentList +
+ ) + } +}) + +var CommentForm = React.createClass({ + render : function () { + return ( +
+ hello I am a CommentForm +
+ ) + } +}) + diff --git a/public/scripts/test3.js b/public/scripts/test3.js new file mode 100644 index 00000000..b1699b8d --- /dev/null +++ b/public/scripts/test3.js @@ -0,0 +1,15 @@ +var CommentBox = React.createClass({ + render : function () { + return ( +
+ + +
+ ) + } +}) + +React.render( + React.createElement(CommentBox, null), + document.getElementById('content') +); \ No newline at end of file