Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped
23 lines
531 B
TypeScript
23 lines
531 B
TypeScript
export interface UseControlledProps<T = unknown> {
|
|
/**
|
|
* Holds the component value when it's controlled.
|
|
*/
|
|
controlled: T | undefined;
|
|
/**
|
|
* The default value when uncontrolled.
|
|
*/
|
|
default: T | undefined;
|
|
/**
|
|
* The component name displayed in warnings.
|
|
*/
|
|
name: string;
|
|
/**
|
|
* The name of the state variable displayed in warnings.
|
|
*/
|
|
state?: string;
|
|
}
|
|
|
|
export default function useControlled<T = unknown>(
|
|
props: UseControlledProps<T>,
|
|
): [T, (newValue: T | ((prevValue: T) => T)) => void];
|