0
路由器NOMATCH路線我有這樣的結構反應動態路由
<Route path="user" component={Users}>
<Route path=":userId" component={User}>
<Route path=":project" component={Project}/>
<Route path="*" component={NotFound} />
</Route>
<Route path="*" component={NotFound} />
</Route>
<Route path="*" component={NotFound} />
不管我如何努力嘗試設置<NoMatch />
,我總是能獲得通過url
要麼user id
或project id
這並不存在。我現在已經有兩天了,這讓我感到非常困惑,因爲我迷失了互聯網上不同的方法/答案,我感到非常困惑。
使用react-router v3.0.2
我不能使用用戶ID數組檢查':userId'路徑嗎? – nehel
我想你可以使用ID數組檢查:userId路徑,如果沒有匹配,則重定向到notfound路由。 – paqash