Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
react-mkx-storage
Advanced tools
This package provides custom React hooks for managing state in local storage, session storage and cookie storage: useLocalStorage, useSessionStorage and useCookieStorage.
This package provides three custom React hooks for managing state in local storage, session storage and cookie storage: useLocalStorage
, useSessionStorage
and useCookieStorage
.
You can install the package using npm:
npm install react-mkx-storage
Or using yarn:
yarn add react-mkx-storage
useLocalStorage
A custom React hook to manage state in local storage.
key
(string): The key under which to store the value in local storage.initialValue
(string | number | object | array): The initial value to use if no value is found in local storage.import { useLocalStorage } from 'react-mkx-storage';
const MyComponent = () => {
const [value, setValue] = useLocalStorage('key', 'initialValue');
// Use value and setValue as needed
return (
// Your component JSX
);
};
useSessionStorage
A custom React hook to manage state in session storage.
key
(string): The key under which to store the value in session storage.initialValue
(string | number | object | array): The initial value to use if no value is found in session storage.import { useSessionStorage } from 'react-mkx-storage';
const MyComponent = () => {
const [value, setValue] = useSessionStorage('key', 'initialValue');
// Use value and setValue as needed
return (
// Your component JSX
);
};
useCookieStorage
A custom React hook to manage state in Cookie storage.
key
(string): The key under which to store the value in Cookie storage.initialValue
(string | number | object | array): The initial value to use if no value is found in Cookie storage.import { useCookieStorage } from 'react-mkx-storage';
const MyComponent = () => {
const [value, setValue] = useCookieStorage('key', 'initialValue');
// Use value and setValue as needed
return (
// Your component JSX
);
};
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
This project is licensed under the ISC License - see the LICENSE file for details.
FAQs
This package provides custom React hooks for managing state in local storage, session storage and cookie storage: useLocalStorage, useSessionStorage and useCookieStorage.
The npm package react-mkx-storage receives a total of 21 weekly downloads. As such, react-mkx-storage popularity was classified as not popular.
We found that react-mkx-storage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.