React——生命週期

一、組件初始化(initialization)階段 super(props),將父組件的props傳給給子組件 constructor()用來做一些組件的初始化工作,如定義this.state的初始內容 二、組件的掛載(Mounting)階段 componentWillMount —— 在組件被掛載到頁面之前調用,只調用一次 render componentDidMount —— 在組件已經被掛載
相關文章
相關標籤/搜索