<script src="http://cdn.bootcss.com/react/0.14.0-beta2/JSXTransformer.js"></script>
<script src="http://cdn.bootcss.com/react/0.14.0-beta2/react.js"></script>
<body>
<div id="app"></div>
<script type="text/jsx">
var HelloWorld = React.createClass({
render: function(){
return (
<div> Hello World </div>
)
}
});
React.render(<HelloWorld />, document.getElementById('app')); </script>
</body>
<script type="text/jsx">
var Child = React.createClass({
render: function(){
return (
<div> The Child </div>
)
}
});
var Parent = React.createClass({
render: function(){
return (
<div>
<div> Hello World </div>
<Child/>
</div>
)
}
});
React.render(<Parent />, document.getElementById('app'));
</script>
网友评论