學習react-簡單小案例(3)
阿新 • • 發佈:2017-12-05
classname type this ont body ava ldr char scrip
<html> <head> <title></title> <meta charset="UTF-8"/> <script src="js/react.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/react-dom.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/browser.min.js" type="text/javascript" charset="utf-8"></script> <style type="text/css"> .borderstyle{ border: 1px solid #ccc; width: 12%; } </style> </head> <body> <divid="container"></div> </body> <script type="text/babel"> var Crud = React.createClass({ render:function(){ return ( <div className="borderstyle"> <div>{this.props.children}</div><button>編輯</button> <button>刪除</button> </div> ); } }); ReactDOM.render( <div> <Crud>Hello world</Crud> </div>, document.getElementById(‘container‘) ); </script> </html>
this.props.children獲取值
學習react-簡單小案例(3)