1、最近自学react,做一个小系统,点击登出按钮报

React  Cannot read property 'push' of undefined 解决方法

2、一查资料,发现是需要从父组件把history传下来

代码为

history={this.props.history}
React  Cannot read property 'push' of undefined 解决方法

3、效果出来了

React  Cannot read property 'push' of undefined 解决方法

相关文章:

  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-09-11
  • 2021-11-22
  • 2021-07-09
  • 2021-12-02
  • 2021-10-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
  • 2021-08-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案