React实例4-属性
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>test01</title>
<script src="build/browser.min.js"></script>
<script src="build/react.js"></script>
<script src="build/react-dom.js"></script>
<script type="text/babel">
class Comp extends React.Component{
render(){
return <span>我是{this.props.name},我已经{this.props.age}岁啦</span>;
}
}
window.onload=function(){
ReactDOM.render(
<Comp name="blue" age="18"/>,
document.getElementById('app'),function(){
console.log("渲染成功啦")
}
);
}
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>