New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

use-local-storage-state

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-local-storage-state - npm Package Compare versions

Comparing version 11.0.0 to 12.0.0

9

es/src/createLocalStorageStateHook.js

@@ -0,1 +1,2 @@

import { unstable_batchedUpdates } from 'react-dom';
import { useCallback, useEffect, useMemo } from 'react';

@@ -9,5 +10,7 @@ import useLocalStorageStateBase from './useLocalStorageStateBase';

const setValueAll = useCallback((newValue) => {
for (const setValueFunction of setValueFunctions) {
setValueFunction(newValue);
}
unstable_batchedUpdates(() => {
for (const setValueFunction of setValueFunctions) {
setValueFunction(newValue);
}
});
}, []);

@@ -14,0 +17,0 @@ useEffect(() => {

@@ -70,2 +70,6 @@ import storage from './storage';

useEffect(() => {
// https://github.com/astoilkov/use-local-storage-state/issues/30
if (isFirstRender.current && defaultState.value === undefined) {
return;
}
// set the `defaultValue` in the localStorage on initial render:

@@ -72,0 +76,0 @@ // https://github.com/astoilkov/use-local-storage-state/issues/26

{
"name": "use-local-storage-state",
"version": "11.0.0",
"version": "12.0.0",
"description": "React hook that persist data in localStorage",
"license": "MIT",
"repository": "astoilkov/use-local-storage-state",
"funding": "https://github.com/sponsors/astoilkov",
"author": {

@@ -13,13 +14,11 @@ "name": "Antonio Stoilkov",

"keywords": [
"use",
"react",
"hook",
"local",
"localStorage",
"persistent",
"state",
"useState",
"hooks",
"react",
"state",
"store",
"storage",
"persistent",
"localStorage",
"local storage"
"local storage",
"store"
],

@@ -48,3 +47,4 @@ "module": "es/index.js",

"peerDependencies": {
"react": ">=16.8.0"
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
},

@@ -51,0 +51,0 @@ "devDependencies": {

@@ -112,3 +112,3 @@ # `use-local-storage-state`

- `removeItem()` — [example](#reseting-to-defaults)
- `isPersistent()` — [example]()asdfasdfasdf
- `isPersistent()` — [example](#handling-edge-cases-with-ispersistent)

@@ -115,0 +115,0 @@ #### key

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const react_dom_1 = require("react-dom");
const react_1 = require("react");

@@ -11,5 +12,7 @@ const useLocalStorageStateBase_1 = require("./useLocalStorageStateBase");

const setValueAll = react_1.useCallback((newValue) => {
for (const setValueFunction of setValueFunctions) {
setValueFunction(newValue);
}
react_dom_1.unstable_batchedUpdates(() => {
for (const setValueFunction of setValueFunctions) {
setValueFunction(newValue);
}
});
}, []);

@@ -16,0 +19,0 @@ react_1.useEffect(() => {

@@ -72,2 +72,6 @@ "use strict";

react_1.useEffect(() => {
// https://github.com/astoilkov/use-local-storage-state/issues/30
if (isFirstRender.current && defaultState.value === undefined) {
return;
}
// set the `defaultValue` in the localStorage on initial render:

@@ -74,0 +78,0 @@ // https://github.com/astoilkov/use-local-storage-state/issues/26

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc