source: imaps-frontend/node_modules/react-use/esm/useDeepCompareEffect.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 764 bytes
RevLine 
[d565449]1import useCustomCompareEffect from './useCustomCompareEffect';
2import isDeepEqual from './misc/isDeepEqual';
3var isPrimitive = function (val) { return val !== Object(val); };
4var useDeepCompareEffect = function (effect, deps) {
5 if (process.env.NODE_ENV !== 'production') {
6 if (!(deps instanceof Array) || !deps.length) {
7 console.warn('`useDeepCompareEffect` should not be used with no dependencies. Use React.useEffect instead.');
8 }
9 if (deps.every(isPrimitive)) {
10 console.warn('`useDeepCompareEffect` should not be used with dependencies that are all primitive values. Use React.useEffect instead.');
11 }
12 }
13 useCustomCompareEffect(effect, deps, isDeepEqual);
14};
15export default useDeepCompareEffect;
Note: See TracBrowser for help on using the repository browser.