Install the Package
Install nuqs using your preferred package manager:nuqs requires React 18.2.0 or higher. For Next.js, version 14.2.0+ is required.
Set Up Your Adapter
nuqs requires a framework adapter to be wrapped around your React component tree. Choose the adapter that matches your framework:Next.js (App Router)
Wrap your application with theNuqsAdapter in your root layout:
src/app/layout.tsx
Next.js (Pages Router)
Wrap your application in_app.tsx:
src/pages/_app.tsx
React (SPA)
For plain React applications (Vite, Create React App, etc.):src/main.tsx
Remix
Requires @remix-run/react version 2 or higher.
app/root.tsx
React Router v6
Requires react-router-dom version 6.
src/main.tsx
React Router v7
Wrap your application in the root route:app/root.tsx
TanStack Router
src/routes/__root.tsx
Custom Adapter
If you’re using a different router or framework, you can create a custom adapter. See the Custom Adapter guide for details.Verify Installation
You’re all set! Let’s verify everything works by creating a simple component:Only needed for Next.js App Router
?test=hello!
Next Steps
Quick Start
Build your first component with nuqs
Framework Adapters
Learn more about adapters and how they work
Parsers
Explore built-in parsers for type-safe state
API Reference
Dive into the complete API documentation