Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing active route outside of router #96

Open
rehmulus opened this issue Oct 20, 2022 · 0 comments
Open

Accessing active route outside of router #96

rehmulus opened this issue Oct 20, 2022 · 0 comments

Comments

@rehmulus
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant