Skip to main content
The Remix adapter enables nuqs to work seamlessly with Remix v2 applications.

Installation

1

Install nuqs

Install nuqs in your Remix project:
2

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.
3

Use nuqs hooks in your routes

Now you can use useQueryState and useQueryStates in any route component:
app/routes/search.tsx

Version Requirements

  • Remix: @remix-run/react@>=2
  • React: >=18.2.0 or ^19.0.0-0

Features

Integration with Remix Navigation

The adapter uses Remix’s useNavigate() and useSearchParams() hooks under the hood, providing seamless integration with Remix’s routing system.

Optimistic UI Updates

Use useOptimisticSearchParams for optimistic UI updates:
This hook returns the search params that will be applied after pending navigation completes.

Shallow Updates

By default, URL updates in client components are shallow (client-side only):
To trigger loader re-runs, use shallow: false:

Server-Side Usage

Reading Search Params in Loaders

Use createLoader 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:
  1. Uses Remix’s useSearchParams() to read current search params
  2. Uses Remix’s useNavigate() to update the URL
  3. Automatically handles route transitions and navigation
  4. 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 set shallow: false:

Type errors with Remix

Ensure you have compatible versions:
  • @remix-run/react@>=2
  • react@>=18.2.0
Update your dependencies if needed: