简单React生命周期
0 1

常见 React的生命周期函数 有哪些?分别说明?它们的作用是什么?

【概念释义】

React 类组件生命周期分挂载、更新、卸载三阶段。挂载:constructor → getDerivedStateFromProps → render → componentDidMount;更新:getDerivedStateFromProps → shouldComponentUpdate → render → getSnapshotBeforeUpdate → componentDidUpdate;卸载:componentWillUnmount。函数组件用 Hooks(useEffect 等)对应副作用时机。

【基础使用】

jsx

登录查看完整 1784

回答讨论

暂无讨论,登录后可抢先发言

本题库更多题目(50)