Typed state, living in the URL

useUrlState is React state that writes itself to the query string. Objects, arrays and dates keep their types, every state is a shareable link, and it survives reloads — no providers, no boilerplate.

  • ~2 KB gzipped
  • zero dependencies
  • TypeScript-first
  • Next.js / react-router / Remix
  • MIT
npm i state-in-url

useSharedState hook for React

{
  "name": "",
  "age": 0,
  "agree": false
}