Skip to main content
Version: 1.2.1-beta1.0

Interface: MnemonicProviderProps

Defined in: src/Mnemonic/provider.tsx:67

Props for the MnemonicProvider component.

Extends MnemonicProviderOptions with required children prop.

See

Extends

Properties

children

readonly children: ReactNode

Defined in: src/Mnemonic/provider.tsx:71

React children to render within the provider.


enableDevTools?

readonly optional enableDevTools: boolean

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

Enable DevTools debugging interface.

When enabled, registers this provider in the global window.__REACT_MNEMONIC_DEVTOOLS__ registry.

The registry stores providers as weak references and exposes:

  • resolve(namespace) to strengthen a provider reference and access inspection methods.
  • list() to enumerate provider availability.

Default

false;

Example

// Enable in development only
enableDevTools: process.env.NODE_ENV === "development";

// Then in browser console:
const provider = window.__REACT_MNEMONIC_DEVTOOLS__?.resolve("myApp");
provider?.dump();
provider?.get("user");
provider?.set("user", { name: "Test" });

Inherited from

MnemonicProviderOptions.enableDevTools


namespace

readonly namespace: string

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

Namespace prefix for all storage keys.

All keys stored by this provider will be prefixed with ${namespace}. to avoid collisions between different parts of your application or different applications sharing the same storage backend.

Example

// With namespace="myApp", a key "user" becomes "myApp.user" in storage
namespace: "myApp";

Inherited from

MnemonicProviderOptions.namespace


schemaMode?

readonly optional schemaMode: SchemaMode

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

Versioning and schema enforcement mode.

Controls whether stored values require a registered schema, and how missing schemas are handled. See SchemaMode for the behaviour of each mode.

Default

"default";

See

Inherited from

MnemonicProviderOptions.schemaMode


schemaRegistry?

readonly optional schemaRegistry: SchemaRegistry

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

Schema registry used for version lookup and migration resolution.

When provided, the library uses the registry to find the correct JSON Schema for each stored version, and to resolve migration paths when upgrading old data to the latest schema.

Required when schemaMode is "strict" or "autoschema". Optional (but recommended) in "default" mode.

Remarks

In "default" and "strict" modes, the registry is treated as immutable after the provider initializes. Updates should be shipped as part of a new app version and applied by remounting the provider. "autoschema" remains mutable so inferred schemas can be registered at runtime.

See

Inherited from

MnemonicProviderOptions.schemaRegistry


ssr?

readonly optional ssr: MnemonicProviderSSRConfig

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

Server-rendering and hydration defaults for descendant hooks.

Provider-level SSR settings establish the default hydration strategy for all useMnemonicKey(...) calls in this namespace. Individual hooks may still override the strategy when a specific key needs different behavior.

Example

<MnemonicProvider namespace="app" ssr={{ hydration: "client-only" }}>
<App />
</MnemonicProvider>

Inherited from

MnemonicProviderOptions.ssr


storage?

readonly optional storage: StorageLike

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

Storage backend to use for persistence.

Defaults to window.localStorage in browser environments. You can provide a synchronous custom implementation (e.g., sessionStorage, an in-memory cache facade over IndexedDB, or a mock for testing).

Default

window.localStorage;

Example

// Use sessionStorage instead of localStorage
storage: window.sessionStorage

// Use a custom storage implementation
storage: {
getItem: (key) => myCustomStore.get(key),
setItem: (key, value) => myCustomStore.set(key, value),
removeItem: (key) => myCustomStore.delete(key)
}

Inherited from

MnemonicProviderOptions.storage