# nuqs

Manage application state in Next.js effortlessly by utilizing the URL query string for state persistence and synchronization.

[Website](https://nuqs.47ng.com) [GitHub](https://github.com/47ng/nuqs) [npm](https://npmjs.com/package/nuqs)

This library provides a hook for managing state in Next.js applications using the URL query string, similar to the useState hook in React. It allows developers to easily sync component state with the URL, enabling state preservation during navigation and refreshing.

### Features

The library includes robust support for both the app and pages routers of Next.js, ensuring that it works seamlessly across various routing setups. It features a simple API that is familiar to React developers, allowing for quick adoption.

### Key Features Include:

- Type-safe end-to-end type safety between server and client components.

- Universal support for both app and pages routers.

- A familiar React.useState-like API that synchronizes with the URL.

- Built-in parsers for common state types, like integers, floats, booleans, etc.

- History control options that allow for replacement or appending to the browser history.

- Designed for client-first updates with options to notify the server for re-calibrating rendered components.

- A dedicated hook, `useQueryStates`, for managing multiple related query state variables simultaneously.

- Tiny and lightweight, only 4.39 kB gzipped.

- Comprehensive testing against every Next.js release.

- Customizable parsers and serializers to suit developer requirements.

## Features

- Type-safe
- End-to-end type safety between server and client components
- Universal support for both app and pages routers
- Simple API similar to React.useState
- Built-in parsers for common types
- History controls for state management
- Client-first shallow updates
- Server cache for type-safe access in nested React Server Components
- Support for useTransition to get loading states
- Customizable parsers and serializers
- Lightweight with minimal bundle size
- Tested against all Next.js releases

## Details

**GitHub Stars**

5.1K

**NPM Downloads**

287.6K/week

**Latest Version**

2.2.3

**Created at**

May 11, 2020

**Updated at**

Dec 6, 2024

**License**

MIT License

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20KickstartUI)

[Ad 680+ tools for your AI agents through one MCP server.](https://multitaskai.com/?ref=kickstartui)

## Related Items

### [Mantine](https://kickstartui.com/details/mantine/)

A comprehensive solution for developing accessible and responsive user interfaces quickly and efficiently.

**GitHub Stars**

27.0K

**Updated at**

Dec 6, 2024

**License**

MIT License

### [React Router](https://kickstartui.com/details/react-router/)

An essential tool for managing routing and navigation in React applications, enhancing both developer efficiency and application performance.

**GitHub Stars**

53.4K

**Updated at**

Dec 6, 2024

**License**

MIT License

### [Hybrids](https://kickstartui.com/details/hybrids/)

This framework empowers developers to build efficient, maintainable web applications and components using a combination of declarative and functional programming techniques.

**GitHub Stars**

3.1K

**Updated at**

Dec 6, 2024

**License**

MIT License

### [Next.js](https://kickstartui.com/details/nextjs/)

A robust solution for creating asynchronous, dynamic web applications with a rich feature set that enhances developer productivity.

**GitHub Stars**

127.6K

**Updated at**

Dec 6, 2024

**License**

MIT License

### [React DnD](https://kickstartui.com/details/react-dnd/)

This library provides an efficient way to implement drag-and-drop capabilities within React applications without worrying about the intricacies of browser APIs.

**GitHub Stars**

21.1K

**Updated at**

Dec 6, 2024

**License**

MIT License

### [React Hook Form](https://kickstartui.com/details/react-hook-form/)

A powerful form handling library that simplifies the process of managing forms in React applications, with a focus on performance and usability.

**GitHub Stars**

41.8K

**Updated at**

Dec 6, 2024

**License**

MIT License

### [TanStack Query](https://kickstartui.com/details/tanstack-query/)

This tool revolutionizes the way you handle asynchronous data in your applications, offering a declarative and automatic solution that enhances both developer and user experiences.

**GitHub Stars**

42.8K

**Updated at**

Dec 6, 2024

**License**

MIT License

### [TanStack Router](https://kickstartui.com/details/tanstack-router/)

A modern and scalable routing library designed specifically for React, specializing in type safety and efficient data management.

**GitHub Stars**

8.4K

**Updated at**

Dec 6, 2024

**License**

MIT License
