UNPKG

jotai-location

Version:
17 lines (16 loc) • 834 B
import type { SetStateAction, WritableAtom } from 'jotai/vanilla'; import { type Options, type Location } from './atomWithLocation.js'; /** * Creates an atom that manages a single search parameter. * * The atom automatically infers the type of the search parameter based on the * type of `defaultValue`. * * The atom's read function returns the current value of the search parameter. * The atom's write function updates the search parameter in the URL. * * @param key - The key of the search parameter. * @param defaultValue - The default value of the search parameter. * @returns A writable atom that manages the search parameter. */ export declare const atomWithSearchParams: <T extends string | number | boolean>(key: string, defaultValue: T, options?: Options<Location>) => WritableAtom<T, [SetStateAction<T>], void>;