@spark-ui/hooks
Version:
Common hooks for Spark UI
13 lines (11 loc) • 454 B
text/typescript
/**
* This hook must be used when a component has both a controlled and uncontrolled mode.
* It will take care of updating the state value when a controlled mode (prop) is updated.
*/
declare function useCombinedState<T>(controlledValue?: T, defaultValue?: T, onChange?: (nextValue: T) => void): [
T | undefined,
(newValue: T, forceFlag?: (prev: T, next: T) => boolean) => void,
boolean,
T | undefined
];
export { useCombinedState };