1. 程式人生 > >react生命周期知識點

react生命周期知識點

bubuko ini ron color 服務端 ima 知識 bsp 依次

react生命周期知識點

一個React組件的生命周期分為三個部分:實例化、存在期和銷毀時。

實例化

組件在客戶端被實例化,第一次被創建時,以下方法依次被調用:

1、getDefaultProps
2、getInitialState
3、componentWillMount
4、render
5、componentDidMount

當組件在服務端被實例化,首次被創建時,以下方法依次被調用:

1、getDefaultProps
2、getInitialState
3、componentWillMount
4、render

技術分享圖片

react生命周期知識點