The right way to trigger a funciton on route change #13100
Answered
by
brunnerh
karchung0930
asked this question in
Q&A
-
I need to trigger a function when the user is going/switching from to another route, and I found this on Stack Overflow: https://stackoverflow.com/a/69275106 Is this the correct and most efficient way? |
Beta Was this translation helpful? Give feedback.
Answered by
brunnerh
Sep 2, 2024
Replies: 1 comment 2 replies
-
There are various lifecycle functions that can be used: (This only applies to SvelteKit, so probably should have been over there.) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
karchung0930
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are various lifecycle functions that can be used:
onNavigate
beforeNavigate
afterNavigate
(This only applies to SvelteKit, so probably should have been over there.)