React

主要方法:
React.createClass({
//1.初始化state,返回值是个对象
getInitialState: function() {
return {};
},
//2.渲染页面方法,最外面只能有一个标签
render(){
return <div></div>;
},
//3.render方法之前执行,主要用于初始化数据,例如列表初始化发送请求
componentDidMount(){

},
//4.当props的值改变的时候使用,参数为新的props值
componentWillReceiveProps(props){

},
//4.初始化props
getDefaultProps:function(){

}

});

其他方法概要:
1.componentWillMount()
render之前使用
2.componentDidMount()
render之后使用
3.componentWillUpdate(object nextProps, object nextState)
组件更新之前调用
4.componentDidUpdate(object prevProps, object prevState)
组件更新之后调用
5.componentWillUnmount()
移除当前组件的时候使用,一般用于释放内存
6.componentWillReceiveProps(object nextProps)
已加载组件收到新的参数时调用
7.shouldComponentUpdate(object nextProps, object nextState)
组件判断是否重新渲染时调用
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值