UNPKG

@open-condo/miniapp-utils

Version:

A set of helper functions / components / hooks used to build new condo apps fast

16 lines (14 loc) 386 B
/** * Returns previous state value, useful for diff comparison * @example * const [count, setCount] = useState(0) * const prevCount = usePrevious(value) * * return ( * <button onClick={() => setValue(current => current + 1)}> * Diff: {count - prevCount} * </button> * ) */ declare function usePrevious<T>(state: T): T | undefined; export { usePrevious };