Skip to content
Discussion options

You must be logged in to vote

Outside of a Svelte component you can't use the $store syntax to get the value of the page store. You could use get:

import { get } from 'svelte/store';
import { page } from '$app/stores';
export function myFunction() {
  let urlPath = get(page).url.pathname;
  goto(urlPath)
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@realJogicodes
Comment options

Answer selected by realJogicodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants