Skip to main content
Version: 1.4.0

Interface: MnemonicKeyState<T>

Defined in: src/Mnemonic/types.ts:1154

Return shape from useMnemonicKey.

This mirrors the familiar useState mental model while making the storage semantics explicit:

  • set(...) writes a new persisted value
  • reset() writes defaultValue back into storage
  • remove() deletes the key entirely so reads fall back to defaultValue

See the Clearable Persisted Values guide for the semantic differences between clearing, resetting, and removing a key.

See​

UseMnemonicKeyOptions - Hook configuration and lifecycle details

Type Parameters​

Type ParameterDescription
TThe decoded value type for the key

Properties​

remove()​

remove: () => void

Defined in: src/Mnemonic/types.ts:1179

Delete the key from storage entirely.

Future reads will fall back to defaultValue until the key is written again.

Returns​

void


reset()​

reset: () => void

Defined in: src/Mnemonic/types.ts:1171

Reset the key back to defaultValue and persist that default.

Returns​

void


set()​

set: (next) => void

Defined in: src/Mnemonic/types.ts:1166

Persist a new value.

Accepts either a direct replacement value or an updater function that receives the current decoded value.

Parameters​

ParameterType
nextT | (current) => T

Returns​

void


value​

value: T

Defined in: src/Mnemonic/types.ts:1158

Current decoded value, or the default when the key is absent or invalid.