<Provider store={store}>
<BrowserRouter>
<div>
<Switch>
<Route
path="/test/:id"
component={Question1} />
<Route
path="/test/:id"
component={Question2} />
</div>
</BrowserRouter>
</Provider>
idが1の質問2からid2の質問2に移動する必要があります。質問1に問題なく移動できますが、しかし、私はthis.props.history.push('/test/2')
を使って質問に行きたいとき、URLは変わりますが、私はquestion2にナビゲートしません。React-router-dom:2つのコンポーネントを1つのルートでレンダリングします。
アイデア?
props.match.params.idのパラメータが不足しています –