You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.
Firstly, thanks for a great alternative to react-router.
I'm struggling to work out how to implement a 404 page though, which seems to be what forNoMatch is intended for. Unfortunately, it doesn't really seem to do the trick as it will greedily match urls through the hierarchy you define in your parent React component.
For example, if I change one of the links in the demo to /dog/foobar, which is clearly not a valid path based on either routes.js or demo.js, I still don't see the 404 content when I click on it because the url has already matched /dog, which is resolved to /dog* in resolveCurrentRoute. As a result you just get a page with no content, as there's no matching route in routes.js, but the 404 component is nowhere to be seen.
The only work around for this I can think of is to list all valid routes in the route configuration (whether there's any data associated with them or not) and then have a top-level wrapper component which displays the 404 content rather than the Fragment tree if the current router state has no result.
Could you let me know if I'm missing something here? Is there a way to achieve this using forNoMatch Fragments?
The text was updated successfully, but these errors were encountered:
Firstly, thanks for a great alternative to react-router.
I'm struggling to work out how to implement a 404 page though, which seems to be what
forNoMatch
is intended for. Unfortunately, it doesn't really seem to do the trick as it will greedily match urls through the hierarchy you define in your parent React component.For example, if I change one of the links in the demo to
/dog/foobar
, which is clearly not a valid path based on eitherroutes.js
ordemo.js
, I still don't see the 404 content when I click on it because the url has already matched/dog
, which is resolved to/dog*
in resolveCurrentRoute. As a result you just get a page with no content, as there's no matching route inroutes.js
, but the 404 component is nowhere to be seen.The only work around for this I can think of is to list all valid routes in the route configuration (whether there's any data associated with them or not) and then have a top-level wrapper component which displays the 404 content rather than the Fragment tree if the current
router
state has noresult
.Could you let me know if I'm missing something here? Is there a way to achieve this using
forNoMatch
Fragments?The text was updated successfully, but these errors were encountered: