home / skills / andrelandgraf / fullstackrecipes / url-state-management
This skill helps you sync React state to URL query parameters for shareable filters, search, and deep links using nuqs.
npx playbooks add skill andrelandgraf/fullstackrecipes --skill url-state-managementReview the files below or copy the command above to add this skill to your agents.
---
name: url-state-management
description: Sync React state to URL query parameters for shareable filters, search, and deep-linkable dialogs with nuqs.
---
# URL State Management
Sync React state to URL query parameters for shareable filters, search, and deep-linkable dialogs with nuqs.
## Prerequisites
Complete these recipes first (in order):
### Next.js on Vercel
Create a Next.js app running on Bun, configure the development environment, and deploy to Vercel with automatic deployments on push.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/nextjs-on-vercel
```
## Cookbook - Complete These Recipes in Order
### URL State with nuqs
Sync React state to URL query parameters for shareable filters, search queries, and deep links to modal dialogs. Preserves UI state on browser back/forward navigation.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/nuqs-setup
```
### Working with nuqs
Manage React state in URL query parameters with nuqs. Covers Suspense boundaries, parsers, clearing state, and deep-linkable dialogs.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/using-nuqs
```
This skill syncs React state to URL query parameters using nuqs to enable shareable filters, preserved search queries, and deep-linkable dialogs. It provides production-ready patterns and step-by-step guidance for integrating URL-driven UI state into full stack web AI apps. Ideal for apps that need back/forward navigation fidelity and easy sharing of UI state via links.
The skill shows how to map React state to query parameters with nuqs, including parsing, serialization, and default value handling. It covers preserving UI state across navigation, clearing and resetting query-driven state, and making modal dialogs deep-linkable so they open from a URL. Recipes include setup, Suspense-aware usage, and practical patterns for Next.js deployments.
Do I need Next.js to use this pattern?
No—nuqs works in client React apps, but the recipes include Next.js deployment guidance to ensure server rendering and routing integrate smoothly.
How do I avoid exposing sensitive data in the URL?
Keep sensitive values out of query params; store them server-side or in session storage. Use query params only for non-sensitive UI state.