为什么反应路由器4不重定向?

时间:2017-05-26 01:48:38

标签: react-router-v4

我正在使用react-router-dom而我没有重定向。以下是路线:

import { Redirect, Route, Switch } from 'react-router-dom';

<Switch>
  <Route path="/home" component={Home} />
  <Route path="/drills/list" component={Drills.List} />
  <Route path="/drills/list/:filter" component={Drills.List} />

  <Redirect from="/drills" to="/drills/list/active" />

  <Redirect to="/error" />
</Switch>

此外,这是我的初始Router配置:

import { Router } from 'react-router-dom';

<Provider store={getStore()}>
    <Router routes={routes} />
</Provider>

所有Route的工作没有问题,但当网址是Redirect之一时,没有任何反应。例如,如果http://localhost:3000/foo,则网址不会更改并加载父网页。有什么想法吗?

0 个答案:

没有答案
相关问题