【RN - 基础一】之React Native组件的生命周期

2017-08-18  本文已影响38人  lltree

本文为转载文章,只因原作者写的太好了,读完瞬间理解,原网址:http://blog.csdn.net/u012583459/article/details/52999564

20170511182906291.png

这张图很简洁直观地告诉我们,生命周期的整个流程以及阶段划分。

第一阶段

getDefaultProps -> getInitialState -> componentWillMount ->render ->componentDidMount。 事实上,每个组件都会经历这个流程生命周期,是一个组件创建跟加载的过程。

第二阶段

运行中 ->属性(props)改变( 父层界面发生改变) ->componentWillReceiveProps->shouldComponentUpdate—true—>componentWillUpdate ->render->componentDidUpdate ->运行中。当然还有运行中—(状态发生改变)—>shouldComponentUpdate-…, 该过程发生在用户界面交互过程中。

第三阶段

卸载前->componentWillUnmount ->结束

总结

WechatIMG173.jpeg
上一篇 下一篇

猜你喜欢

热点阅读