"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var react_1 = require("react"); var useFirstMountState_1 = require("./useFirstMountState"); var strictEquals = function (prev, next) { return prev === next; }; function usePreviousDistinct(value, compare) { if (compare === void 0) { compare = strictEquals; } var prevRef = react_1.useRef(); var curRef = react_1.useRef(value); var isFirstMount = useFirstMountState_1.useFirstMountState(); if (!isFirstMount && !compare(curRef.current, value)) { prevRef.current = curRef.current; curRef.current = value; } return prevRef.current; } exports.default = usePreviousDistinct;