llms.txt Content
# state-in-url
A React hook library for storing complex state objects in browser URLs with full TypeScript type preservation.
## What It Does
state-in-url synchronizes React state with URL query parameters, enabling:
- State sharing between unrelated components without prop drilling or context
- State persistence across page reloads via URL
- Shareable links that preserve application state
- Type-safe state management with full TypeScript inference
## Package Information
- **NPM:** https://www.npmjs.com/package/state-in-url
- **GitHub:** https://github.com/asmyshlyaev177/state-in-url
- **Website:** https://state-in-url.dev
- **Main Documentation:** https://raw.githubusercontent.com/asmyshlyaev177/state-in-url/refs/heads/master/README.md
## Supported Frameworks
| Framework | Versions | Documentation |
|-----------|----------|---------------|
| Next.js | v14-v15 | https://raw.githubusercontent.com/asmyshlyaev177/state-in-url/refs/heads/master/packages/urlstate/next/useUrlState/README.md |
| React Router | v7 | https://raw.githubusercontent.com/asmyshlyaev177/state-in-url/refs/heads/master/packages/urlstate/react-router/useUrlState/README.md |
| React Router | v6 | https://raw.githubusercontent.com/asmyshlyaev177/state-in-url/refs/heads/master/packages/urlstate/react-router6/useUrlState/README.md |
| Remix | v2 | https://raw.githubusercontent.com/asmyshlyaev177/state-in-url/refs/heads/master/packages/urlstate/remix/useUrlState/README.md |
## Installation
```bash
npm install state-in-url
```
## Import Paths by Framework
```typescript
// Next.js
import { useUrlState } from "state-in-url/next";
// React Router v7
import { useUrlState } from "state-in-url/react-router";
// React Router v6
import { useUrlState } from "state-in-url/react-router6";
// Remix
import { useUrlState } from "state-in-url/remix";
```
## Core API: useUrlState Hook
The primary hook for state management synchronized with URL query parameters.
**Returns:**
- `urlState`: Current state ob