Installation
Add the adapter to your root
Wrap your application with
NuqsAdapter in your root component:app/root.tsx
The
NuqsAdapter should wrap the <Outlet /> component to provide context to all routes.Version Requirements
- Remix:
@remix-run/react@>=2 - React:
>=18.2.0or^19.0.0-0
Features
Integration with Remix Navigation
The adapter uses Remix’suseNavigate() and useSearchParams() hooks under the hood, providing seamless integration with Remix’s routing system.
Optimistic UI Updates
UseuseOptimisticSearchParams for optimistic UI updates:
Shallow Updates
By default, URL updates in client components are shallow (client-side only):shallow: false:
Server-Side Usage
Reading Search Params in Loaders
UsecreateLoader to parse search params in Remix loaders:
app/routes/products.tsx
Reading from URL in Loaders
You can also pass the full URL or Request object:How It Works
The Remix adapter:- Uses Remix’s
useSearchParams()to read current search params - Uses Remix’s
useNavigate()to update the URL - Automatically handles route transitions and navigation
- Provides optimistic updates through
useOptimisticSearchParams()
Examples
Pagination
app/routes/blog.tsx
Multiple Filters
app/routes/products.tsx
Troubleshooting
Adapter not found error
Make sure you’re importing from the correct adapter path:Loaders not re-running
To trigger loader re-runs, explicitly setshallow: false:
Type errors with Remix
Ensure you have compatible versions:@remix-run/react@>=2react@>=18.2.0