React Router v5 Adapter

Using nuqs in React Router v5 applications.

François Best

François Best

@franky47

Installation

npx shadcn@latest add @nuqs/adapter-react-router-v5

Usage

Wrap your <BrowserRouter> with the <NuqsAdapter>:

import { NuqsAdapter } from './nuqs-adapter'

export function ReactRouter() {
  return (
    <NuqsAdapter>
      <BrowserRouter>
        <Switch>{/* Your routes here */}</Switch>
      </BrowserRouter>
    </NuqsAdapter>
  )
}

Compatibility

This adapter is compatible with nuqs@^2.8: support for react-router-dom@^5 was extended in nuqs@2.8.0, but will likely be removed in nuqs@3.0.0.

If you need support for React Router v5, pin your dependency to nuqs@^2.


The custom adapters APIs are not yet stable and may change in the future in a minor or patch release (not following SemVer).

Use the registry's RSS feed to stay updated on any changes.

On this page