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
url-state-demo.tsxCopy code
Installation
Copy code
Brings alongurl-router
Usage
ImportCopy code
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 UrlWriteOptionsAgent actions
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.