UNPKG

state-in-url

Version:

Store state in URL as in object, types and structure are preserved, with TS validation. Same API as React.useState, wthout any hasssle or boilerplate. Next.js@14-15, react-router@6-7, and remix@2.

4 lines (3 loc) 264 B
import { type JSONCompatible } from '../utils'; /** Keeps what `setUrl` keeps — params the shape does not own. `href`'s own win. */ export declare function hrefWithState<T extends JSONCompatible>(href: string, shape: T, state: T, currentSearch: string): string;