首页 > 其他 > 详细

React组件生命周期-初始化阶段的函数执行顺序

时间:2015-12-16 23:01:30      阅读:355      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    <script src="./react-0.13.2/build/react.js"></script>
    <script src="./react-0.13.2/build/JSXTransformer.js"></script>
	<script type="text/jsx">
		var style = {
			color : "red",
			border: "1px #000 solid",
		};
		var HelloWorld = React.createClass({
			getDefaultProps: function(){console.log("getDefaultProps1");},
			getInitialState: function(){console.log("getInitialState2");return null;},
			componentWillMount:function(){console.log("componentWillMount3")},
			render: function(){
				console.log("render4");
				return <p>初始化阶段的函数执行状态</p>
			},
			componentDidMount:function(){console.log("componentDidMount5")}
		});
		React.render(<div style={style}><HelloWorld></HelloWorld></div>, document.body);
	</script>
</body>

</html>

  技术分享

 

React组件生命周期-初始化阶段的函数执行顺序

原文:http://www.cnblogs.com/shamgod/p/5052547.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!