Nested routes rendering with React-Router and Express is not working
1 min readAug 8, 2017
Simple paths like /current
are rendering fine on refresh, but as soon as a second layer is reached, /current/all
for example, the console sends the following error:
Uncaught SyntaxError: Unexpected token <
The problem is caused by the browser using relative urls. The solution is to specify the base URL so that all path are defined relative to /
. Adding <basehref="/">
in the head fixes the problem.