get router pathname #1292
Replies: 1 comment 1 reply
-
import { useRouterState } from '@tanstack/react-router';
const pathname = useRouterState({ select: (s) => s.location.pathname }); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
datfooldive
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I try to get pathname when changing routers because I want to add scroll to the top when changing routes. How do we get the pathname? For example, in react-router-dom, we use useLocation.
Beta Was this translation helpful? Give feedback.
All reactions