source: imaps-frontend/node_modules/react-use/lib/useDeepCompareEffect.js@ d565449

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

Update repo after prototype presentation

  • Property mode set to 100644
File size: 956 bytes
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4var useCustomCompareEffect_1 = tslib_1.__importDefault(require("./useCustomCompareEffect"));
5var isDeepEqual_1 = tslib_1.__importDefault(require("./misc/isDeepEqual"));
6var isPrimitive = function (val) { return val !== Object(val); };
7var useDeepCompareEffect = function (effect, deps) {
8 if (process.env.NODE_ENV !== 'production') {
9 if (!(deps instanceof Array) || !deps.length) {
10 console.warn('`useDeepCompareEffect` should not be used with no dependencies. Use React.useEffect instead.');
11 }
12 if (deps.every(isPrimitive)) {
13 console.warn('`useDeepCompareEffect` should not be used with dependencies that are all primitive values. Use React.useEffect instead.');
14 }
15 }
16 useCustomCompareEffect_1.default(effect, deps, isDeepEqual_1.default);
17};
18exports.default = useDeepCompareEffect;
Note: See TracBrowser for help on using the repository browser.