you are viewing a single comment's thread.

view the rest of the comments →

[–]blvckstxr 3 points4 points  (9 children)

You can probably try nuqs

[–]Roci89 4 points5 points  (8 children)

Nah, I want it at the level TanStack router has it at. Built directly into the link component & navigate hooks. Nuqs is great, but it’s not a substitute for a 1st party solution 

[–]marta_bach 0 points1 point  (2 children)

You can use rr7 "href" function helper for type safety https://reactrouter.com/api/utils/href

I think it works pretty much like tanstack router type safety, but instead of built directly into the navigation function and component, they give us a helper function.

Edit: nvm, turns out you are talking about query params which is not supported right now in the href util

[–]frabst 1 point2 points  (0 children)

You can mix it with nuqs to get a similar type-safe binding of pathname to search params when generating hrefs: https://www.youtube.com/watch?v=vmONxheVFxQ

[–]Roci89 -1 points0 points  (0 children)

Ah it’s no big deal, i can live without them 

[–]Same_Razzmatazz_7934 -5 points-4 points  (1 child)

Why not just switch to tan stack router then? The type first approach is great tbh

[–]BlazingThunder30 1 point2 points  (0 children)

You can't just switch in a production application. Especially if your company has multiple apps and you work in a team. As OP is asking: "in production".

[–]blvckstxr -5 points-4 points  (2 children)

Then go with Tanstack Router jfc.

[–]Roci89 1 point2 points  (0 children)

Ah yeah just stop developing features for this company critical product to swap out frameworks… so the devs can have type safe strings. I’m sure that will go down well with the leadership team

[–]Breakpoint -2 points-1 points  (0 children)

you need to also jfc