useEffectState.d.ts 516 B

123456789101112
  1. type Updater<T> = T | ((origin: T) => T);
  2. type UpdateCallbackFunc = VoidFunction;
  3. type NotifyEffectUpdate = (callback: UpdateCallbackFunc) => void;
  4. /**
  5. * Batcher for record any `useEffectState` need update.
  6. */
  7. export declare function useBatcher(): NotifyEffectUpdate;
  8. /**
  9. * Trigger state update by `useLayoutEffect` to save perf.
  10. */
  11. export default function useEffectState<T extends string | number | object>(notifyEffectUpdate: NotifyEffectUpdate, defaultValue?: T): [T, (value: Updater<T>) => void];
  12. export {};