State in url

State management and deep links

Store complex state in query parameters; imagine JSON in a browser URL, while keeping types and structure of data.

useUrlState - demo with react-router

First client component
Other client component

Types and structure of data are presered

{
name:
age:
agree: false
tags: []
}

Motivation

Main goal is to provide state management with URI and good developer experience, there are many similar libraries, but non of them are easy enough to use, or lack functionality.

state-in-url provides useUrlState hook for Next.js/react-router. With it you can store state easily without a lot of boilerplate, and implement Deep Links pattern for your App.
No need to wrap components in a provider, can share data between unrelated client components. API is very similar to React.useState.

Structure and types are preserved, with full Typescript support.

Code quality

Library developed with best practices and TDD in mind, and it's ready for production use.

Other frameworks or pure JS

There are more hooks and helpers to deal with serialization/decoding of data.
Check out GitHub page. Give Us a star.

Share this on social networks to help the library, purely voluntarily :)

Uneed Embed Badge