S
S
Sergey Yaroshuk2017-10-15 12:39:11
React
Sergey Yaroshuk, 2017-10-15 12:39:11

404 in react-router 2.0.0?

There was a problem while learning react-router. The course uses router 2.0.0-rc5 version.
If you write a route like this:

<Route path='/' component={App}>
    <IndexRoute component={PostsIndex} />
    <Route path="posts" component={PostsNew} /> 
  </Route>

Then following the link ..../posts produces the PostsNew component, as it should.
But if the route is written like this:
<Route path='/' component={App}>
    <IndexRoute component={PostsIndex} />
    <Route path="posts/new" component={PostsNew} /> 
  </Route>

Then the link .../posts/new issues 404. What could be the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question