use-synchronized-state 1.0.8 → 1.0.10
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.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var react=require("react");function useSyncState(e){var
|
|
1
|
+
var react=require("react");function useSyncState(e){var t=react.useState(!0)[1],c=react.useRef(e),r=react.useRef(e),r=(r.current!==e&&(r.current=e,c.current=e),react.useCallback(function(e){var r=c.current;c.current=e instanceof Function?e(c.current):e,r!==c.current&&t(function(e){return!e})},[c]));return[c.current,r]}exports.useSyncState=useSyncState;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState,useRef,useCallback}from"react";function useSyncState(e){var t=useState(
|
|
1
|
+
import{useState,useRef,useCallback}from"react";function useSyncState(e){var t=useState(!0)[1],u=useRef(e),r=useRef(e),r=(r.current!==e&&(r.current=e,u.current=e),useCallback(function(e){var r=u.current;u.current=e instanceof Function?e(u.current):e,r!==u.current&&t(function(e){return!e})},[u]));return[u.current,r]}export{useSyncState};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-synchronized-state",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "A React hook that creates a synchronized state with a reactive value in react (fixing the Cascading updates issue)",
|
|
5
5
|
"homepage": "https://github.com/rhorge/use-safe-context#readme",
|
|
6
6
|
"bugs": {
|