T
TanStack11mo ago
unwilling-turquoise

Path Param vs Search Param

What is the Tanstack philosophy on when to use path params vs search params? I've seen in some of the examples things like posts.$postId.tsx for a route, but in the file-based kitchen sink dashboard example the code uses searchParams for the userId. Does it basically come down to personal preference or is there a more concrete reasoning for using one or the other? Thanks
2 Replies
inland-turquoise
inland-turquoise11mo ago
it's both. sometimes a matter of taste, sometimes it is that search params allow much more flexibility with default, optional search params
unwilling-turquoise
unwilling-turquoiseOP11mo ago
Cool thanks, I’ll have to do some more experimenting with each in different scenarios!

Did you find this page helpful?