Ever wish Next.js had better type-safety on the routing layer? We did too, so made a pattern adding full type-safety and runtime validation for route and query params. In this blog, I detail the pattern and include the little code utilities for you to copy/paste. Link in next post.
8
14
117
21K
117
Download Image
@flybayer Why not use URLSearchParams instead of query-string?
@flybayer Very cool. Didn’t know about this feature. I’ll add shameless plug (hope you don’t mind) - my NPM package to validate input for Route Handlers in Next npmjs.com/package/next-a…