wouter
Version:
Minimalist-friendly ~1.5KB router for React
32 lines (28 loc) • 667 B
TypeScript
import {
BaseLocationHook,
BaseSearchHook,
Path,
SearchString,
} from "./location-hook.js";
type Navigate<S = any> = (
to: Path,
options?: { replace?: boolean; state?: S }
) => void;
type HookReturnValue = {
hook: BaseLocationHook;
searchHook: BaseSearchHook;
navigate: Navigate;
};
type StubHistory = { history: Path[]; reset: () => void };
export function memoryLocation(options?: {
path?: Path;
searchPath?: SearchString;
static?: boolean;
record?: false;
}): HookReturnValue;
export function memoryLocation(options?: {
path?: Path;
searchPath?: SearchString;
static?: boolean;
record: true;
}): HookReturnValue & StubHistory;