T
TanStack5w ago
other-emerald

Different "from" values between useNavigate and useSearch

Hey, wondering why useNavigate works with from: '/route-a', but useSearch needs from: '/_pathlessLayout/_nested-layout/route-a'?
const navigate = useNavigate({
from: '/route-a'
});
const searchParams = useSearch({
from: '/_pathlessLayout/_nested-layout/route-a',
});
const navigate = useNavigate({
from: '/route-a'
});
const searchParams = useSearch({
from: '/_pathlessLayout/_nested-layout/route-a',
});
Shouldn’t they both resolve from the same route? Is that the intended behavior? Example
StackBlitz
Router Basic File Based Example (duplicated) - StackBlitz
Run official live example code for Router Basic File Based, created by Tanstack on StackBlitz
No description
1 Reply
rival-black
rival-black5w ago
yes , one is a path the other a route id different concepts

Did you find this page helpful?