0
私は以下のルートを持っています。私は次のように使用して行われるフローの現在のステップ数を取得するためにchildRoutes
を使用MyLayout
コンポーネント内経路の順序は重要ですか?
<Route path='/route/:id/other' component={MyLayout} >
<IndexRoute component={Form} />
<Route path='me' component={Form} />
<Route path='nothing' component={NothingComponent} />
<Route path='something' component={SomethingComponent} />
</Route>
。
routes[0].childRoutes.forEach((route, index) => {
if (route.path === currentStep) {
currentStep = index + 1;
}
});
それから1
ステップを指定して上記のスクリプトによって生成され、このフォーマット1 of 3
のメッセージを表示するためにこれを使用します。現在、childRoutes
の注文を考慮に入れており、無効な結果が表示されています。 1 of 3
の代わりに2 of 3
ルートの順序がこれに影響しますか?
0 = <Route path='me' ...
1 = <Route path='nothing' ...
2 = ...