import { useEffect, useRef } from 'react';
import { isBrowser } from '../util/const.js';
import { basicDepsComparator } from '../util/misc.js';
export function useCustomCompareEffect(callback, deps, comparator = basicDepsComparator, effectHook = useEffect, ...effectHookRestArgs) {
    const dependencies = useRef();
    if (dependencies.current === undefined ||
        (isBrowser && !comparator(dependencies.current, deps))) {
        dependencies.current = deps;
    }
    effectHook(callback, dependencies.current, ...effectHookRestArgs);
}
