react hooks优缺点
优点:
1. 不同组件和生命周期之间的逻辑复用
2. 不需要使用高阶组件进行逻辑抽离
3. 不需要去理解class中的this指向问题
缺点:
hooks的useEffect只包括了componentDidMount,componentDidUpdate和componentWillUnmount这三
个生命周期,对于其他的class类组件的生命周期则是不支持
hooks暂时还没有一些生命周期的等价写法,getSnapshotBeforeUpdate、getDerivedStateFromError和componentDidCatch

浙公网安备 33010602011771号