You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I added the router import to the template in the file svelte-router-template/src/js/app.svelte where createRouter is called but $router appears always as undefined:
$router provides only the router itself, it won't update when the router object mutates, as far as I understand. You can use the onNavigationChanged method to actually listen for navigations. I did it like this:
letunregister=$router.onNavigationChanged((from,to)=>{/* do stuff */})onDestroy(()=>{unregister()unregister=null})
I also needed to access the router in the same file in which I created it, though (in order to add a navigation guard and error handler), so I used the following helper function:
Hi there.. the router store is not updating or reacting..
My guess that is not creating an object or array brand new.. causing Svelte not realizing that the object/store has changed.
Anyway.. many thanks!
=)
The text was updated successfully, but these errors were encountered: