"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isDeepEqual = exports.default = void 0;
var _react = require("react");
var _react2 = _interopRequireDefault(require("fast-deep-equal/es6/react"));
const isDeepEqual = _react2.default;
exports.isDeepEqual = isDeepEqual;
function useDeepCompareMemoize(value) {
  const ref = (0, _react.useRef)();
  // it can be done by using useMemo as well
  // but useRef is rather cleaner and easier
  if (!isDeepEqual(value, ref.current)) {
    ref.current = value;
  }
  return ref.current;
}
function useDeepCompareEffect(effect, dependencies = []) {
  (0, _react.useEffect)(effect, useDeepCompareMemoize(dependencies));
}
var _default = useDeepCompareEffect;
exports.default = _default;