UNPKG

616 BTypeScriptView Raw
1import type { SetStateAction } from 'react';
2export interface Options<T> {
3 defaultValue?: T;
4 defaultValuePropName?: string;
5 valuePropName?: string;
6 trigger?: string;
7}
8export type Props = Record<string, any>;
9export interface StandardProps<T> {
10 value: T;
11 defaultValue?: T;
12 onChange: (val: T) => void;
13}
14declare function useControllableValue<T = any>(props: StandardProps<T>): [T, (v: SetStateAction<T>) => void];
15declare function useControllableValue<T = any>(props?: Props, options?: Options<T>): [T, (v: SetStateAction<T>, ...args: any[]) => void];
16export default useControllableValue;