useMergedState.d.ts 562 B

1234567891011121314
  1. type Updater<T> = (updater: T | ((origin: T) => T), ignoreDestroy?: boolean) => void;
  2. /** We only think `undefined` is empty */
  3. export declare function hasValue(value: any): boolean;
  4. /**
  5. * Similar to `useState` but will use props value if provided.
  6. * Note that internal use rc-util `useState` hook.
  7. */
  8. export declare function useMergedState<T, R = T>(defaultStateValue: T | (() => T), option?: {
  9. defaultValue?: T | (() => T);
  10. value?: T;
  11. onChange?: (value: T, prevValue: T) => void;
  12. postState?: (value: T) => T;
  13. }): [R, Updater<T>];
  14. export {};