在react中点击事件里面 setState 时会使this重新定义,所以在点击的函数里面使用this.setState()时会报错this.setState not a function,因此需要提前给点击事件的函数绑定this


在使用函数式 setState 时报错 this.setState is not a function

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-12-11
  • 2022-01-23
  • 2021-10-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-19
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案