React 组件

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="js/react.js"></script>
<script src="js/react-dom.js"></script>
<script src="js/browser.min.js"></script>
</head>
<body>
<div id="example"></div>

<script type="text/babel">

var TitleComponent = React.createClass({
render:function(){
return <h1> Web</h1>;
}
})

var InfoComponent = React.createClass({
render:function(){
return <p> it is a good class </p>
}
})

var ComplexComponent = React.createClass({
render:function(){
return <div>
<TitleComponent/>
<InfoComponent/>
</div>
}
})

ReactDOM.render(
<ComplexComponent/>,
document.getElementById('example')
)
</script>
</body>
</html>
posted @ 2017-08-09 09:16  ThisCall  阅读(123)  评论(0编辑  收藏  举报