TanStackT
TanStack5mo ago
1 reply
dead-brown

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',
});


Shouldn’t they both resolve from the same route?
Is that the intended behavior?

Example
image.png
StackBlitz
Run official live example code for Router Basic File Based, created by Tanstack on StackBlitz
Router Basic File Based Example (duplicated) - StackBlitz
Was this page helpful?