TanStackT
TanStack16mo ago
1 reply
endless-jade

General Navigation with Previous Search

When I do the following I get a TS error:
// product: 'apple' | 'banana' | 'orange'
const navigate = useNavigate({from: `/fruits/${product}`})
//...
const gotoDetails= () => {
  // TS Error: prev is any
  navigate({to: `/fruits/${product}/details`, search: (prev) => prev})
}


How do I properly type this? Take note that each product has its own search params that I would like to have carried over to the details page.
Was this page helpful?