可以通过父组件传给子组件history.push()的方式去解决
父组件代码
render() {
return (
<div className="homePage">
<MyAppModal history ={this.props.history} />
</div>
)
}
子组件的调用history.push()方法
async openProject(index){
return await this.props.history.push('/myproject/'+index);
}