@metreeca/tile
    Preparing search index...
    • Binds a component to a value kept in Web Storage.

      The component renders the value the entry holds, or initial while the entry is empty. It stays in step with the entry whoever changes it: the returned setter, or another page writing the entry, removing it or clearing the storage area. Changes made by other pages arrive only for storage areas the browser shares across pages, in practice localStorage.

      The storage area and the key may change between renders. The component then renders and follows the new entry, and the previous entry is left untouched.

      Type Parameters

      • T

        The type of the stored value

      Parameters

      • storage: Storage

        The storage area holding the entry, usually localStorage or sessionStorage

      • key: string

        The name of the entry in storage

      • initial: Lazy<T>

        The value shown while the entry holds none, or a factory creating it

      Returns [T, (value: T | undefined) => void]

      The value as it stands for this render, and a setter storing a new one; setting undefined removes the entry, so that the view shows initial again

      SyntaxError If the entry holds a value that is not well-formed JSON