import React, { useEffect, useRef } from 'react';
import useDeepCompareEffect from 'use-deep-compare-effect';

/**
 * useDeepCompareEffect ignorando o primeiro valor
 * @param effect
 * @param deps
 */
export const useDidUpdateDeepCompareEffect: typeof useEffect = function useDidUpdateDeepCompareEffect(
   effect,
   deps?,
): any {
   const didMountRef = useRef(false);

   useDeepCompareEffect(() => {
      if (didMountRef.current) effect();
      else didMountRef.current = true;
   }, deps);
};
