home / skills / andrelandgraf / fullstackrecipes / nuqs-setup
This skill syncs React state with URL query parameters to enable shareable filters and deep links while preserving UI state.
npx playbooks add skill andrelandgraf/fullstackrecipes --skill nuqs-setupReview the files below or copy the command above to add this skill to your agents.
---
name: nuqs-setup
description: 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.
---
# URL State with nuqs
To set up URL State with nuqs, refer to the fullstackrecipes MCP server resource:
**Resource URI:** `recipe://fullstackrecipes.com/nuqs-setup`
If the MCP server is not configured, fetch the recipe directly:
```bash
curl -H "Accept: text/plain" https://fullstackrecipes.com/api/recipes/nuqs-setup
```
This skill syncs React state to URL query parameters to create shareable filters, search queries, and deep links to modal dialogs. It preserves UI state across browser back/forward navigation and is implemented in TypeScript for production-ready full stack web AI apps. The setup follows a compact recipe that works with a Shadcn-based UI and integrates easily into existing React routing.
The setup serializes selected pieces of component state into URL query parameters and restores them on mount or navigation events. It listens for popstate events so back/forward navigation restores previous UI state instead of only changing the route. The recipe exposes simple helpers to read, write, and debounce query updates so you can keep the URL authoritative without frequent re-renders.
Do I need a special server to use this?
No. The recipe can be fetched from the MCP server URL, but it works client-side in any React app. If the MCP endpoint is unavailable, you can retrieve the recipe directly via the provided curl command.
How does this handle large or sensitive state?
Avoid placing sensitive data in the URL. For large state, store an identifier in the query and keep the full payload on the server or local storage, fetching it when the ID is present.