svelte-router
svelte-router copied to clipboard
Improvement: currentRoute should be a store
Yo Jorge, I hope you're safe in these times of distress.
I suggest to let currentRoute to be a svelte store to listen for changes in layout pages for example.
Alternatively, expose a callback raised at every page change. This should be less breaking as a change.
Hi @artecoop All good here, so far. I hope you are doing good as well.
The idea of converting currentRoute to a store has already crossed my mind.
Before taking any decision I'm going to start testing that locally and see how it works.
Best,
Hi! Help please! :) How can I listen for route changes in sub-sub-sub-components (currentRoute not visible there) for duplicated navigation menu highlitning?
EDIT: My bad. Seems like directly importing activeRoute
only returns the root route info, not the current one the component is in.
i think the import {activeRoute} from "svelte-router-spa/src/store";
should be exported in the main file like import {activeRoute} from "svelte-router-spa";