jotai-location
Version:
20 lines (19 loc) • 869 B
TypeScript
import type { WritableAtom } from 'jotai/vanilla';
import { RESET } from 'jotai/vanilla/utils';
type SetStateActionWithReset<Value> = Value | typeof RESET | ((prev: Value) => Value | typeof RESET);
export type SetHashOption = 'default' | 'replaceState' | ((searchParams: string) => void);
export type AtomWithHashSetOptions = {
setHash?: SetHashOption;
};
export declare const setHashWithPush: (searchParams: string) => void;
export declare const setHashWithReplace: (searchParams: string) => void;
export declare function atomWithHash<Value>(key: string, initialValue: Value, options?: {
serialize?: (val: Value) => string;
deserialize?: (str: string) => Value;
subscribe?: (callback: () => void) => () => void;
setHash?: SetHashOption;
}): WritableAtom<Value, [
SetStateActionWithReset<Value>,
AtomWithHashSetOptions?
], void>;
export {};