React——生命周期

一、组件初始化(initialization)阶段 super(props),将父组件的props传给给子组件 constructor()用来做一些组件的初始化工作,如定义this.state的初始内容 二、组件的挂载(Mounting)阶段 componentWillMount —— 在组件被挂载到页面之前调用,只调用一次 render componentDidMount —— 在组件已经被挂载
相关文章
相关标签/搜索