reactjs url在navlink上更改但视图不会更改

时间:2018-06-05 07:50:11

标签: javascript css html5 reactjs react-router

<Route path="/dashboard/:id/:screenId/:userId" component={this.Routing}/>

此处:ID为个人资料,:screenId为时间轴朋友主题,具体取决于特定标签我点击并:userId是一个特定的 tokenId

因此,对于一个实例,网址看起来像

dashboard/profile/timeline/abc123 OR dashboard/profile/friends/abc123 etc.

但无论是在:id 之后,每当我点击标签时,网址都会改变,但视图不会改变。我必须重新加载页面才能获得视图。任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

t get why you use three URL parameters. I get you need URL parameter for tokens but for rendering different components you don不需要网址参数。

<Route path="/dashboard/profile/timeline/:token" component={...}/>
<Route path="/dashboard/profile/friends/:token" component={...}/>
<Route path="/dashboard/profile/subjects/:token" component={...}/>

但也许对于您的用例,您需要三个不同的URL参数。那么可能有更多解释?

相关问题