from Hacker News

Show HN: Type-safe search params state management for Next.js

by franky47 on 8/5/24, 3:38 PM with 1 comments

Next.js has APIs to read and update search params (the /?foo=bar part of the URL), but they lack type-safety for consistent keys and proper parsing/serializing of JS data types. I found myself repeatedly building the same custom hook to get a React.useState-like approach. In 2021, I published it to NPM and then forgot about it.

Since then, the `nuqs` package has gained popularity and is now used by companies like Vercel, Auth.js, Gitbook, and Midday.ai, with 200K weekly downloads.

It's been fun building this as a side project and automating as much as possible to ensure a high-quality output.

  • by pontusabra on 8/5/24, 5:37 PM

    I really love nuqs, recommend it to everyone! thanks!