Dynamic routing #13765
-
We have an app that monitors and controls thousands of devices and depending on the currently selected device we need to have different routes available possibly every time user selects an other device to monitor/control, eg. some devices allow Map page to see the location of the device, while others may not allow it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
In But I think it would be simpler to register every route and in the route loaders only allows access to certain routes based on what those devices allow or not, and if not render a 404 or 403 page. |
Beta Was this translation helpful? Give feedback.
In
createBrowserRouter
you can pass a second argument with apatchRoutesOnNavigation
method to dynamically register routes, and you can use any logic you want to add them there.But I think it would be simpler to register every route and in the route loaders only allows access to certain routes based on what those devices allow or not, and if not render a 404 or 403 page.