UNPKG

519 BTypeScriptView Raw
1export interface UseControlledProps<T = unknown> {
2 /**
3 * This prop contains the component value when it's controlled.
4 */
5 controlled: T | undefined;
6 /**
7 * The default value when uncontrolled.
8 */
9 default: T | undefined;
10 /**
11 * The component name displayed in warnings.
12 */
13 name: string;
14 /**
15 * The name of the state variable displayed in warnings.
16 */
17 state?: string;
18}
19
20export default function useControlled<T = unknown>(
21 props: UseControlledProps<T>
22): [T, (newValue: T) => void];