T
TanStack11mo ago
xenial-black

Dynamic value of useSearch() from?

Hello, I'd like to create a custom hook that uses useSearch() hook with with full type-safety. I have 2 almost identical pages, with same search params and I'd like to use this hook only there. Is it possible to allow the useSearch to look either for one or the other one URL as 'from'?
3 Replies
extended-salmon
extended-salmon11mo ago
i had a similar problem and just added a from parameter to the custom hook, that accepts the url of those routes and then pass it to useSearch
national-gold
national-gold11mo ago
yeah sounds like a good solution
passive-yellow
passive-yellow10mo ago
@ilarramendi What was the type you gave your from parameter?

Did you find this page helpful?