useStorage API
API reference for the useStorage composable.
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| useStorage | Plugins |
| useHydration | Plugins |
| Plugins | Fundamentals |
Functions
createStorageContext
<_E>(_options?: StorageContextOptions | undefined) => ContextTrinity<_E>createStoragePlugin
(_options?: StorageContextOptions | undefined) => PluginuseStorage
<_E>(namespace?: string) => _EOptions
adapter
StorageAdapter | undefinedThe storage adapter to use. Defaults to localStorage in browser, MemoryStorageAdapter otherwise
serializer
{ read: (value: string) => unknown; write: (value: unknown) => string; } | undefinedCustom serializer for reading and writing values. Defaults to JSON.parse/stringify
ttl
number | undefinedTime-to-live in milliseconds. When set, expired entries return the default value on `get()` and `set()` automatically timestamps entries.