-
Notifications
You must be signed in to change notification settings - Fork 0
/
combineReact.html
49 lines (47 loc) · 1.72 KB
/
combineReact.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="Develop/js/lib/lodash.min.js"></script>
<script src="Develop/js/seed/seed.js"></script>
<script src="Develop/js/seed/lang//function.js"></script>
<script src="Develop/js/seed/widget.js"></script>
<script src="Develop/js/path.js"></script>
<script src="Develop/js/seed/loader/loader.js"></script>
<script src="Develop/js/seed/modules.js"></script>
<script src="Develop/js/lib/react.js"></script>
<script src="Develop/js/lib/JSXTransformer.js"></script>
</head>
<body>
<div id="container">
componentWillMount()<br>
componentDidMount()<br>
componentWillUpdate(object nextProps, object nextState)<br>
componentDidUpdate(object prevProps, object prevState)<br>
componentWillUnmount()<br>
此外,React 还提供两种特殊状态的处理函数。<br>
componentWillReceiveProps(object nextProps):已加载组件收到新的参数时调用<br>
shouldComponentUpdate(object nextProps, object nextState):组件判断是否重新渲染时调用
</div>
<div id="example">我一直渲染透明度</div>
<script type="text/jsx">
var LikeButton = React.createClass({
getInitialState: function(){
return {value:this.props.name};
},
handleChange: function(event) {
this.setState({value: event.target.value.substr(0, 10)});
},
render: function() {
var value = this.state.value;
return <input type="text" value={value} onChange={this.handleChange} />;
}
});
React.render(
<LikeButton name="alei" />,
document.getElementById("example")
);
</script>
</body>
</html>