從 ReactNative中數據發(fā)生變化到把新的數據渲染到頁面中, ReactNative生命周期函數按照什么順序執(zhí)行?
當組件數據發(fā)生改變時,會進入存在期,從而執(zhí)行組件生命周期方法,屬性的改變與狀態(tài)的改變相差一個階段。
如果屬性改變,會依次執(zhí)行 componentWillRecivePros、 shouldComponentUpdate、 componentWillUpdate, render, componentDidUpdate。
如果狀態(tài)改變,會依次執(zhí)行 shouldComponentUpdate、componentWillUpdate、 render、 componentDidUpdate。