svelte-navigator icon indicating copy to clipboard operation
svelte-navigator copied to clipboard

Accessing active route outside of router

Open rehmulus opened this issue 2 years ago • 0 comments

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.

rehmulus avatar Oct 20 '22 12:10 rehmulus