I have an Express/React application that uses React Router, and I'm not sure how to handle unspecified routes from the React end of things.
My express configuration calls app.get('/*', handler)
, which renders index.html
so that the routing responsibilities are passed off to React. How can I use React Router to handle routes that haven't been predetermined. For example, if I got to myapp.com/test
, I get the following error:
Location "/test" did not match any routes
How can I configure react-router to serve a 404 page, or to redirect to the default route if the URL is unrecognized?