This is a really great router that does most of the things i didn't thought was possible since no one made it before this one :-) !
However i am struggling with one thing, default routes.
I tried to find a way of handling default routes. As a sample i would like "/" to fallback to "/dashboard/home". But "/dashboard" should also go to "/dashboard/home" :-)
As a background story i am working on a large application with nested routers. I would like each router to fallback to a default page if nothing is matched while updating the url :-)
Here is the codesandbox demonstrating the issue: https://codesandbox.io/s/zxwm87v93.
Please let me know if something is missing :-)
Have you tried using the default prop on the Redirect?
See: https://codesandbox.io/s/myr1ny60x9
I made changes to both src/index.js and src/views/Dashboard/index.js
Awesome, didn't try that :-)
Your solution actually works as i wanted it to. However, now when it works i discovered that the redirect component adds the previous url to the history. Is there any way to use the replace behavior :-) ?
It looks like the implementation should be using replace by default, and it seems to be working that way for me in the browser. If it's not working that way for you, it could be a bug in codesandbox.io.
Great, seems to be a bug in codesandbox :-) Cool, thank you for the guidence, really helped me out :-) !
Most helpful comment
Have you tried using the
defaultprop on the Redirect?See: https://codesandbox.io/s/myr1ny60x9
I made changes to both
src/index.jsandsrc/views/Dashboard/index.js