Overview
nuqs is a React library that brings type-safe state management to URL query parameters. It provides a familiar `useState`-like API that automatically syncs state with the URL, making it easy to build shareable, bookmarkable interfaces without prop drilling.
The library supports multiple React frameworks including Next.js (both app and pages routers), Remix, React Router, TanStack Router, and plain React SPAs. It includes built-in parsers and serializers for common data types, history controls for back-button navigation, and server-side support for React Server Components with type safety across component boundaries.
At just 5.9kB gzipped, nuqs is lightweight yet feature-complete, with comprehensive testing against every Next.js release and a well-designed API for custom parsers and serializers.
Key features
- Type-safe end-to-end state management
- useState-like API synced with URL
- Support for Next.js, Remix, React Router, TanStack Router
- Built-in parsers and serializers
- History controls and back-button support
- Server-side React Server Component support
- useTransition integration for loading states
- Custom parser and serializer support
- Only 5.9kB gzipped
- Tested against every Next.js release
- Familiar React API reduces learning curve
- Automatic URL synchronization eliminates manual state management
- Type safety across server and client components
- Lightweight bundle size
- Multi-framework support
- Built-in utilities for common data types
- Excellent test support and documentation
- Requires React 18.3+ or React 19
- Limited to frameworks with router support
- May require refactoring existing useState-based state management
Best for
Alternatives
More Library
Compare allData-fetching and state management library designed to handle server state in web applications.
Zero-dependency module loading environment variables from .env files into Node.js apps.
JavaScript library designed for building user interfaces with a focus on declarative syntax and efficiency.