import { useEffect , useRef , EffectCallback , DependencyList } from 'react' ; import isEqual from 'react-fast-compare' ; export default function useDeepCompareEffect ( effect , deps ) { const ref = useRef < DependencyList | undefined > ( undefined ) ; if ( ! isEqual ( deps , ref . current ) ) { ref . current = deps ; } useEffect ( effect , ref . current ) ; }