@bhammond/react-stateful
Version:
A Signal and Querystate backed React State management utility library.
10 lines (9 loc) • 386 B
TypeScript
export interface URLParamsLike {
get(key: string): string | null;
}
export interface RecordParams {
[key: string]: string | string[] | undefined;
}
export type ParamsInput = URLParamsLike | RecordParams;
declare function useQueryState<T = string>(name: string, params: ParamsInput, defaultValue?: T): [T, (newValue: T | ((prev: T) => T)) => void];
export default useQueryState;