import { useRef } from 'react' ; import { isEqual } from 'lodash' ; export function useDeepObjectIdentity < T > ( value ) { const valueRef = useRef < T > ( value ) ; if ( ! isEqual ( valueRef . current , value ) ) { valueRef . current = value ; } return valueRef . current ; }