function useCached(value, equalsFn) {
    const cache = useRef(value),
        cachedVal = cache.current;
    if (cachedVal !== value && equalsFn && !equalsFn(cachedVal, value)) {
        cache.current = value;
    }
    return cache.current;
}
/**
 * Hook to return a cached version of a value.
 *
 * This hook is similar useCallback() and useMemo() and useful for providing stable object
 * references across renders.
 *
 * @param {*} value - value to be cached and potentially returned in this and subsequent calls.
 *      Typically an object.
 * @param {function} [equalsFn] - A function taking the previously cached value, and the currently
 *      presented value.  If evaluates to true, the cached value will be returned rather
 *      than the presented value.  If null, any cached value will always be returned.
 */
Hook to return a cached version of a value.
This hook is similar useCallback() and useMemo() and useful for providing stable object
references across renders.

@param {*} value - value to be cached and potentially returned in this and subsequent calls.
Typically an object.
@param {function} [equalsFn] - A function taking the previously cached value, and the currently
presented value.  If evaluates to true, the cached value will be returned rather
than the presented value.  If null, any cached value will always be returned.
Hook to return a cached version of a value . This hook is similar useCallback () and useMemo () and useful for providing stable object references across renders . @param { * } value - value to be cached and potentially returned in this and subsequent calls . Typically an object . @param { function } [ equalsFn ] - A function taking the previously cached value and the currently presented value . If evaluates to true the cached value will be returned rather than the presented value . If null any cached value will always be returned .
function useCached(value, equalsFn) {
    const cache = useRef(value),
        cachedVal = cache.current;
    if (cachedVal !== value && equalsFn && !equalsFn(cachedVal, value)) {
        cache.current = value;
    }
    return cache.current;
}
function useCached ( value , equalsFn ) { const cache = useRef ( value ) , cachedVal = cache . current ; if ( cachedVal !== value && equalsFn && ! equalsFn ( cachedVal , value ) ) { cache . current = value ; } return cache . current ; }
Hook to return a cached version of a value.
Hook to return a cached version of a value .