1

我在我的通用反应应用程序中使用 react-router 2.0。通过 Link 组件导航可以工作,但是当我手动粘贴 url 时没有任何反应(浏览器挂起)。我该如何解决这个问题?这是路由器代码:

<Route path="/" component={App}>
  { /* Home (main) route */ }
  <IndexRoute component={Home}/>

  { /* Routes requiring login */ }
  <Route onEnter={requireLogin}>
    <Route path="chat" component={Chat}/>
    <Route path="loginSuccess" component={LoginSuccess}/>
  </Route>

  { /* Routes */ }
  <Route path="about" component={About}/>
  <Route path="login" component={Login}/>
  <Route path="pagination" component={Pagination}/>
  <Route path="survey/:user" component={Survey}/>
  <Route path="widgets" component={Widgets}/>
  <Route path="search" component={Search}/>
  <Route path="make/model/:id" component={Details}/>
  { /* Catch all route */ }
  <Route path="*" component={NotFound} status={404} />
</Route>
4

1 回答 1

-1

在你的路线中试试这个

在这样的所有路由中添加“/”

<Route path="/about" component={About}/>
于 2017-07-05T07:38:24.993 回答