Skip to content

Get current path in a reactive manner? #1075

Answered by borstessi
mrlubos asked this question in Q&A
Discussion options

You must be logged in to vote

@mrlubos

i think i found the solution.

you can use the useRouterState Hook:

const router = useRouterState();

  console.log("here", router.location.pathname);

it is reactive and will change on navigation

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Emmanuel-Xs
Comment options

@mrlubos
Comment options

@Emmanuel-Xs
Comment options

@Akronae
Comment options

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