In my project I'd like to have a navigation with subnavs that are outside of the route itself and differ for each route. Currently I use a wrapper component in each route that calls useLocation and saves it to a store so I can access the active path and see when it changes.
I think a cleaner solution would be to expose activeRoute in Router.svelte
Locally, I have got it to work by adding export to activeRoute declaration (and adding a line to Router.d.ts) but I don't know if it has any side effects.
In my project I'd like to have a navigation with subnavs that are outside of the route itself and differ for each route. Currently I use a wrapper component in each route that calls
useLocation
and saves it to a store so I can access the active path and see when it changes.I think a cleaner solution would be to expose
activeRoute
in Router.svelteLocally, I have got it to work by adding
export
toactiveRoute
declaration (and adding a line to Router.d.ts) but I don't know if it has any side effects.