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";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | var tslib_1 = require("tslib");
|
---|
4 | var useCustomCompareEffect_1 = tslib_1.__importDefault(require("./useCustomCompareEffect"));
|
---|
5 | var isDeepEqual_1 = tslib_1.__importDefault(require("./misc/isDeepEqual"));
|
---|
6 | var isPrimitive = function (val) { return val !== Object(val); };
|
---|
7 | var 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 | };
|
---|
18 | exports.default = useDeepCompareEffect;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.