import { useRef } from 'react' ; import isEqual from 'lodash/isEqual' ; export default function useObjectDependency < T > ( object ) { const ref = useRef < T > ( ) ; if ( ref . current === undefined || ! isEqual ( ref . current , object ) ) { ref . current = object ; } return ref . current ; }