1import { useRef } from 'react';
2import { isEqual } from 'lodash';
4import usePreviousValue from './usePreviousValue';
6// changes the referential identity of value on deep equality change
7export default function useDeepEqualReference(value) {
8 const ref = useRef(value);
10 // track the old value of the config set
11 const prevValue = usePreviousValue(value);
13 // then compare equality
14 const areEqual = isEqual(value, prevValue);
16 // if equality changes, give value a new identity
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list