首页 > 其他 > 详细

了解一下react的一些钩子函数

时间:2019-12-03 03:07:29      阅读:83      评论:0      收藏:0      [点我收藏+]

挂载

  • construct()
  • static getDerivedStateFromProps()
  • render()
  • componentDidMount()

不建议使用:componentWillMount()

更新

  • static getDerivedStateFromProps()
  • shouldComponentUpdate()
  • render()
  • getSnapshotBeforeUpdate()
  • componentDidUpdate()

不建议使用:componentWillUpdate()、componentWillReceiveProps()

卸载

  • componentWillUnmount

错误处理

  • static getDerivedStateFromError()
  • componentDidCatch()

其他APIs

  • setState()
  • forceUpdate()

class属性

  • defaultProps
  • displayName

实例属性

  • props
  • state

了解一下react的一些钩子函数

原文:https://www.cnblogs.com/let423/p/11973876.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!