useStore

Hook

A hook to manage a local store using IndexedDB via `localforage`.

Usage

const { store, setStore, setStoreValue, isStoreLoaded } = useStore('myStore', { id: 'value1', name: 'value2' })
const { id, name } = store

setStore({ id: 'new value' })
const { store, setStore, setStoreValue, isStoreLoaded } = useStore('myStore', { id: 'value1', name: 'value2' })
const { id, name } = store

setStoreValue('name', 'new value')

Props

name

The name of the store.

type

string

initState

The initial state of the store.

type

Store