React

2015-09-14  本文已影响295人  ShindouHiro
<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>
上一篇下一篇

猜你喜欢

热点阅读