DEV Community

Alex Spinov
Alex Spinov

Posted on

nuqs Has a Free API — Type-Safe URL Search Params for Next.js

What if URL search parameters in Next.js were as simple as useState — with type safety and serialization built in?

nuqs is a type-safe search params state manager for Next.js.

import { useQueryState, parseAsInteger } from "nuqs";

const [page, setPage] = useQueryState("page", parseAsInteger.withDefault(1));
setPage(2); // URL updates to ?page=2
Enter fullscreen mode Exit fullscreen mode

A dashboard replaced 200 lines of URL parsing code with 15 lines using nuqs. Shareable filtered views worked perfectly.

Visit nuqs.47ng.com — MIT licensed, <2KB gzipped.


Need custom data pipelines or scraping solutions? Check out my Apify actors or email me at spinov001@gmail.com for custom solutions.

Top comments (0)