Visit the parent route URL should redirect on an indexed child route with a path #10134
-
Hi everyone. I was wondering if there's neat way to have an
In the example, I've intentionally omitted a "general purpose" settings section. This because, sometimes, there could be cases in which we don't have a child that perfectly matches the meaning of the parent path; so it would be appropriate to show the user a full explanatory URL, after they hit the parent URL.
However it seems a bit hacky to me. The ideal would be set both Thanks to the maintainers of the library, by the way. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Yep! You can do this with optional segments - here's an example: https://codesandbox.io/s/index-with-path-fv3jfr?file=/src/index.js |
Beta Was this translation helpful? Give feedback.
-
Easiest approach would be to add a <Navigate to={'/settings/audio'} /> element as the child pointing to the parent("/")
|
Beta Was this translation helpful? Give feedback.
Yep! You can do this with optional segments - here's an example: https://codesandbox.io/s/index-with-path-fv3jfr?file=/src/index.js