• Hook that retrieves an item safely from local storage, also allowing setting the item and removing it.

    Type Parameters

    • T

    Parameters

    • key: string

      The key to use in local storage. This should be unique to the item.

    • typeGuard: ((item) => boolean)

      A function that checks if the item is of the correct type. This is used to prevent crashes from invalid items in local storage.

        • (item): boolean
        • Parameters

          • item: unknown

          Returns boolean

    • defaultValue: T

      The default value to use if the item is not found in local storage.

    Returns LocalStorageJSONItemFunctions<T>

Generated using TypeDoc