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.
11 lines (10 loc) • 592 B
TypeScript
import { decode, encode } from './encoder';
import { decodeState, encodeState } from './encodeState';
import { useUrlState } from './next';
import { useLinkProps } from './useLinkProps';
import { useSharedState } from './useSharedState';
import { useUrlEncode } from './useUrlEncode';
import { useUrlStateBase } from './useUrlStateBase';
import { isSSR, type JSONCompatible, type Type, typeOf } from './utils';
export { decode, decodeState, encode, encodeState, isSSR, typeOf, useLinkProps, useSharedState, useUrlEncode, useUrlState, useUrlStateBase, };
export type { JSONCompatible, Type };