minishouyin/node_modules/rc-util/lib/hooks/useSyncState.d.ts
2025-11-12 11:35:57 +08:00

10 lines
437 B
TypeScript

type Updater<T> = T | ((prevValue: T) => T);
export type SetState<T> = (nextValue: Updater<T>) => void;
/**
* Same as React.useState but will always get latest state.
* This is useful when React merge multiple state updates into one.
* e.g. onTransitionEnd trigger multiple event at once will be merged state update in React.
*/
export default function useSyncState<T>(defaultValue?: T): [get: () => T, set: SetState<T>];
export {};