TanStackT
TanStackโ€ข2y agoโ€ข
5 replies
dead-brown

How to make search params optional and rely on zod .catch() for default ?

Hello !
When defining routes we can use validateSearch combined with zod schemas in order to type the route search, however this schema cannot be undefined and while we can set defaults with catch(), we are still required to provide said search params when navigating with Link or navigate() and it is a bit tedious

Is there a clean approach to make search params optionnal for navigation ?

Cheers ! ๐Ÿ™‚
Was this page helpful?