<style>
.wm-h{
color:red;
}
</style>
</head>
<body>
<div id="app"></div>
<script type="text/babel">
var Comp=React.createClass({
render:function(){
return <div style={{fontSize:'30px'}} className="wm-h">{this.props.name} <h1>我就试试{this.props.title}</h1></div>;
}
});
ReactDOM.render(
<Comp name="666" title="44944"/>,
document.getElementById('app')
);
</script>
React.createClass声明组件
ReactDOM.render(component,挂载点)
jsx 中 style={{key:value}}形式 key 用驼峰命名
class为 className=”
React Components Lifecycle
hook :
Mounting
1.getDefaultProps()
2.getInitialState()
3.componentWillMount
render
4 componentDidMount
Updating
Unmounting
componentWillUnmount
(个人觉得应该再添加DidUnmount 状态)