Skip to content
Eskais UI

Server data

URL State

Router-agnostic URL state: one UrlStateAdapter shape over the query string (historyUrlState), a hash router's query (hashUrlState) or memory (memoryUrlState), and useUrlState to read and write it.

Example

URL query ?, 0 writes

Installation

npx shadcn@latest add @eskais/url-state
Brings alongurl-router

Usage

Import
import {  hashUrlState,  historyUrlState,  memoryUrlState,  routerUrlState,  useUrlState,} from "@/lib/url-state"

Pick the adapter that matches your router once, and pass it to every screen that keeps state in the URL.

API reference

This item exports functions and types rather than components.

Other exports

hashUrlStatehistoryUrlStatememoryUrlStaterouterUrlStateuseUrlStatetype MemoryUrlStatetype UrlStateAdaptertype UrlStateWindowtype UrlWriteOptions

Agent actions

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.