useStorage ​
Hook that manages storage value
typescript
import { useStorage } from '@siberiacancode/reactuse';
Usage ​
typescript
const { value, set, remove } = useStorage('key', 'value');
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
key | string | - | The key of the storage |
params.serializer? | (value: Value) => string | - | The serializer function |
params.deserializer? | (value: string) => Value | - | The deserializer function |
params.storage? | Storage | - | The storage |
params.initialValue? | UseStorageInitialValue<Value> | - | The initial value of the storage |