如何使用react-router通过onclick硬刷新页面

问题描述 投票:0回答:1

我需要知道如何编写代码以使用react-router通过onClick刷新页面

我尝试使用history.push,但不起作用。

这是我的代码:

  onClick() {
this.props.history.push(`/a/${this.props.a}`);
// window.location.reload();


}

      goPage() {
    return (
      <Button onClick={this.onClick}>
        Begin
      </Button>
    );
  }

如果有人知道,请建议我

谢谢

reactjs react-router react-redux router
1个回答
5
投票

使用它来重新加载页面;

 window.location.reload(); 

© www.soinside.com 2019 - 2024. All rights reserved.