parsec-hooks 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
@@ -35,13 +35,13 @@ var _default = function _default(name, initState) {
|
|
35
35
|
(0, _react.useLayoutEffect)(function () {
|
36
36
|
globalObj[name].sets.push(setGlobalState);
|
37
37
|
}, [name]);
|
38
|
-
return [globalState, function (state) {
|
38
|
+
return [globalState, (0, _react.useCallback)(function (state) {
|
39
39
|
globalObj[name].state = state;
|
40
40
|
setGlobalState(state);
|
41
41
|
globalObj[name].sets.forEach(function (fn) {
|
42
42
|
return fn(state);
|
43
43
|
});
|
44
|
-
}];
|
44
|
+
}, [name])];
|
45
45
|
};
|
46
46
|
|
47
47
|
exports.default = _default;
|