UNPKG

@openshift-console/dynamic-plugin-sdk

Version:

Provides core APIs, types and utilities used by dynamic plugins at runtime.

12 lines (11 loc) 342 B
import * as React from 'react'; import * as _ from 'lodash'; export const useDeepCompareMemoize = (value, strinfigy) => { const ref = React.useRef(); if (strinfigy ? JSON.stringify(value) !== JSON.stringify(ref.current) : !_.isEqual(value, ref.current)) { ref.current = value; } return ref.current; };