Type Alias SetItem<T>

SetItem<T>: ((key: string, data: T) => Promise<void>) | ((key: string, data: T) => void)

Handles state persisting.

Type Parameters

  • T

String identifying persisted state (like in localStorage.setItem(key, …)).

The state to be persisted.

T - The storage state type.

Shouldn't return or resolve returned promise before the state is persisted.