简单React生命周期
0 1

常见 React生命周期 有哪些?分别说明阶段?每个阶段对应的函数是什么?

【概念释义】

类组件生命周期:挂载 constructor → getDerivedStateFromProps → render → componentDidMount;更新 getDerivedStateFromProps → shouldComponentUpdate → render → getSnapshotBeforeUpdate → componentDidUpdate;卸载 componentWillUnmount函数组件useEffect/useLayoutEffect 模拟,无一一同名函数。

【基础使用】

jsx

登录查看完整 1427

回答讨论

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

本题库更多题目(50)