@adobe/data - v0.10.30
    Preparing search index...

    Function createPersistedState

    • Creates a simple state observable that also returns a function to update the value. The state is persisted to the provided storage. Since this is stored in localStorage or sessionStorage it should not be used for large data.

      Type Parameters

      Parameters

      • key: string

        The key to use for storage.

      • OptionalinitialValue: T

        The initial value of the state.

      • storage: Storage = localStorage

        The storage to use for persistence.

      Returns [Observe<T>, (value: T) => void]