码迷,mamicode.com
首页 > 其他好文 > 详细

react componentWillReceiveProps

时间:2017-05-24 11:09:32      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:生效   hand   option   this   组件   sel   receive   ext   isp   

componentWillReceiveProps(nextProps){
不加判断 会可能导致组件本身 setState不生效
if(nextProps.isPersonEdit !==this.props.isPersonEdit){
if(‘isPersonEdit‘ in nextProps){
this.setState({isEdit:nextProps.isPersonEdit})
}
}
}
handleSelect(value,option){
this.setState({isEdit:true})
}

react componentWillReceiveProps

标签:生效   hand   option   this   组件   sel   receive   ext   isp   

原文地址:http://www.cnblogs.com/leijuan/p/6897712.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!