I
I
Igor Shumilovsky2016-06-09 17:07:33
JavaScript
Igor Shumilovsky, 2016-06-09 17:07:33

React-router paths don't work. How to cure?

I've been fighting for a day now and I can't figure out why the routes don't work.
Here, for example, such a route

<Route path="chart" component={Chart}>
    <Route path=":id" component={Test} />
</Route>

domain.com/chart works
domain.com/chart/anything doesn't work anymore. I am getting the following error:
scripts.js:1 Uncaught SyntaxError: Unexpected token <

Tobish, the chunk was not created on this route.
I just didn't do anything. And even the simplest config made the simplest routes. But still, more than 1 level of nesting does not work

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2016-06-09
@JiSeven

Very similar to the error with "issuing a script", i.e.
you don't have script.js there, but index.html is given. See network.
Described in detail in the react-router tutorial in Russian

V
Vitaly Kirenkov, 2016-06-09
@DeLaVega

before :id tried / add?
tried to use DefaultRoute?
have you tried adding a name?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question