import { useRef } from '../lib/teact/teact'; /** * @deprecated */ function usePreviousDeprecated(next: T): T | undefined; function usePreviousDeprecated(next: T, shouldSkipUndefined: true): Exclude | undefined; // eslint-disable-next-line max-len function usePreviousDeprecated(next: T, shouldSkipUndefined?: boolean): Exclude | undefined; function usePreviousDeprecated(next: T, shouldSkipUndefined?: boolean) { const ref = useRef(); const { current } = ref; if (!shouldSkipUndefined || next !== undefined) { ref.current = next; } return current; } export default usePreviousDeprecated;