11 lines
314 B
TypeScript
11 lines
314 B
TypeScript
import { isEqual } from 'radash';
|
|
import usePreviousValue from './usePreviousValue';
|
|
|
|
export const useDeepComparison = (...args: unknown[]) => {
|
|
const prev = usePreviousValue(args);
|
|
if (!prev) return true;
|
|
return args.some((item, index) => !isEqual(item, prev[index]));
|
|
};
|
|
|
|
export default useDeepComparison;
|