UNPKG

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