
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@react-hookful/dom
Advanced tools
Useful react DOM-related hooks that help you clean up you functional components.
Useful react DOM-related hooks that help you clean up you functional components.
# NPM
npm install @react-hookful/dom
# Yarn
yarn install @react-hookful/dom
useLocalStorage but for the session storage.useLocalStorage and useSessionStorageuseLocalStorage<T>(key: string, defaultValue?: T, options?: StorageOptions<T>): StorageValue<T>
Allows you to store and retrieve data to the local store through a hook API.
It takes the key to work with in the store, a optional default value that gets set every time the store lacks a value for the given key.
It also takes some advanced options that are specified in here.
useSessionStorage works the same way this hook does.
import { useLocalStorage } from '@react-hookful/dom';
const Component = () => {
const userOptions = useLocalStorage('user_options', { theme: 'dark', id: 234 });
userOptions.get(); // {theme: 'dark', id: 234}
const success = userOptions.set({ ...userOptions.get(), theme: light });
console.log(success); // true - Indicates if the store throws an error
userOptions.get(); // {theme: 'light', id: 234}
};
StorageOptions<T> interfaceoverride?: boolean - Indicates whether to override the current storage value with the defaultValue param. Defaults to false.parser?: (arg: string | null) => T | null - The function used to parse the value coming from the store. Defaults to JSON.parseserializer?: (arg: T | null) => string - The function that serializes the given value to string. Defaults to JSON.stringify.StorageValue<T> interfaceget: () => T | null - Retrieves and returns the value from the store.set: (value: T | null) => boolean - Sets the given value to the store. Returns false in case of a store error.error?: DOMException - If something goes wrong while setting a value the error gets dump in this field.For more hooks check one of the other sibling packages.
| Package | Version |
|---|---|
| core |
FAQs
Useful react DOM-related hooks that help you clean up you functional components.
We found that @react-hookful/dom demonstrated a not healthy version release cadence and project activity because the last version was released 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.