T
TanStack13mo ago
ambitious-aqua

useMatchRoute and useLocation are not in sync

after i navigate my useLocation and useMatchRoute hooks are out of sync with eachother.
function MyComponent() {
const location = useLocation()
const matchRoute = useMatchRoute()

const matchPath = matchRoute({ to: '/foo' });

console.log(location.pathname) // prints '/foo'
console.log(matchPath) // prints false
}
function MyComponent() {
const location = useLocation()
const matchRoute = useMatchRoute()

const matchPath = matchRoute({ to: '/foo' });

console.log(location.pathname) // prints '/foo'
console.log(matchPath) // prints false
}
any idea why this is happening?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?