Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>本教程 React 实例</title> <script src="http://static.w3big.com/assets/react/react-0.14.7/build/react.js"></script> <script src="http://static.w3big.com/assets/react/react-0.14.7/build/react-dom.js"></script> <script src="http://static.w3big.com/assets/react/browser.min.js"></script> </head> <body> <div id="example"></div> <script type="text/babel"> var title = "本教程"; // var title = 123; var MyTitle = React.createClass({ propTypes: { title: React.PropTypes.string.isRequired, }, render: function() { return <h1> {this.props.title} </h1>; } }); ReactDOM.render( <MyTitle title={title} />, document.getElementById('example') ); </script> </body> </html>