react的生命周期安装:创建组件的实例将其插入DOM时,将按以下顺序调用这些方法:**constructor()static getDerivedStateFromProps()render()componentDidMount()**更新:props or state的更改可能导致更新。重新呈现组件时,将按以下顺序调用这些方法:static getDerivedStateFromProps()shouldComponentUpdate()render()getSnapshotBeforeUpdate()componentDidUpdate()卸载:从DOM中删除组件时调用此方法。componentWillUnmount()