Type of the stored value.
Logical storage key; use null to disable persistence entirely.
OptionaldefaultValue: T | (() => T)
Value used when nothing is stored and the provider has no default for key; a
function is called lazily to produce it.
Options controlling serialization, versioning, and migration.
A tuple of [state, setState, clear]:
state – The current value.setState(next) – Updates the value and persists it (unless key === null).clear() – Removes the persisted value and resets to the default.Like useState's setter, setState and clear keep a stable identity across renders, so they are
safe in dependency lists.
Persisted state hook backed by the current persistence context.
This works like
useState, but:namespace:keyusing the current store.defaultValues[key]if present, otherwisedefaultValue. Defaults are never written to the store; only values passed tosetStateare.setStatewhile the read is still in flight is newer, so it wins and the read is discarded.debounceMsfrom the context.Optional persistence
If
keyisnull, persistence is disabled and the hook behaves like a plainuseStatewith the samedefaultValuesemantics:clear()simply resets back todefaultValue(orundefined).