ls-pro-common 3.0.68 → 3.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,8 +8,13 @@ export default function (initVal) {
8
8
  setState = _useState2[1];
9
9
  var ref = useRef(initVal);
10
10
  var changeState = function changeState(newVal) {
11
+ if (typeof newVal === 'function') {
12
+ newVal = newVal(ref.current);
13
+ }
11
14
  ref.current = newVal;
12
- setState(newVal);
15
+ setState(function () {
16
+ return newVal;
17
+ });
13
18
  };
14
19
  var getState = function getState() {
15
20
  return ref.current;
@@ -8,8 +8,13 @@ export default function (initVal) {
8
8
  setState = _useState2[1];
9
9
  var ref = useRef(initVal);
10
10
  var changeState = function changeState(newVal) {
11
+ if (typeof newVal === 'function') {
12
+ newVal = newVal(ref.current);
13
+ }
11
14
  ref.current = newVal;
12
- setState(newVal);
15
+ setState(function () {
16
+ return newVal;
17
+ });
13
18
  };
14
19
  var getState = function getState() {
15
20
  return ref.current;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.0.68",
3
+ "version": "3.0.69",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [