T
TanStack2y ago
ambitious-aqua

how to get URL or current route

can i somehow get the url or current route in the main component using tanstack/router maybe there is some hook
function App() {
const href = useHook()

if(href === 'someroute') {
return (<Component />)
}

return (
<div>
<Outlet/>
</div>
)
}
function App() {
const href = useHook()

if(href === 'someroute') {
return (<Component />)
}

return (
<div>
<Outlet/>
</div>
)
}
1 Reply
afraid-scarlet
afraid-scarlet2y ago
const location = useRouterState({ select: (s) => s.location})
const location = useRouterState({ select: (s) => s.location})

Did you find this page helpful?