React 入门(3)生命周期函数

序言

生命周期函数

React v16.3 的生命周期图

先来了解一下react的生命周期函数有哪些:

组件将要挂载时触发的函数:componentWillMount

组件挂载完成时触发的函数:componentDidMount

是否要更新数据时触发的函数:shouldComponentUpdate

将要更新数据时触发的函数:componentWillUpdate

数据更新完成时触发的函数:componentDidUpdate

组件将要销毁时触发的函数:componentWillUnmount

父组件中改变了props传值时触发的函数:componentWillReceiveProps

资料

原文地址:https://www.cnblogs.com/cnki/p/12611431.html