求问createBrowserHistory进行路由跳转,路由变化,组件不刷新怎么破
Arthur
#2
路由
<Router>
<div>
<Tab history={history}/>
<Route exact path="/" component={Now} />
<Route path="/film/now-playing" component={Now} />
<Route path="/film/coming-soon" component={Soon} />
</div>
</Router>
changeToNow() {
// this.context.router.history.push("film/coming-soon");
this.props.history.push("/film/now-playing")
}
changeToSoon() {
// this.context.router.history.push("film/coming-soon");
this.props.history.push("/film/coming-soon")
}
render() {
return (
<div>
<button onClick={this.changeToNow.bind(this)}>点我</button>
<button onClick={this.changeToSoon.bind(this)}>点我</button>
</div>
)