Review
- 2024-07-29 13:44
一、Introduction #
React components have a lifecycle consisting of three phases: Mounting, Updating, and Unmounting along with several “lifecycle methods” that you can override to run code at particular times in the process.
Lifecycle diagram
https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/

生命周期 #
4-5-1-1
挂载阶段 #
- constructor
- static getDerivedStateFromProps
- render
- componentDidMount
更新阶段 #
- static getDerivedStateFromProps
- shouldComponentUpdate
- render
- getSnapshotBeforeUpdate
- componentDidUpdate
卸载阶段 #
- componentWillUnmount
异常捕获 #
- componentDidCatch