--- title: useStorage description: Returns the key-value `Storage` interface for the extension target. api_version: 2023-07 api_name: checkout-ui-extensions source_url: html: >- https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/storage/usestorage md: >- https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/storage/usestorage.md --- # use​Storage Returns the key-value `Storage` interface for the extension target. ## use​Storage() ### Returns * Storage ### Storage A key-value storage object for extension targets. Stored data is only available to this specific app at this specific extension target. The storage backend is implemented with `localStorage` and should persist across the buyer's checkout session. However, data persistence isn't guaranteed. * read \(key: string) => Promise\ Read and return a stored value by key. The stored data is deserialized from JSON and returned as its original primitive. Returns `null` if no stored data exists. * write (key: string, data: any) => Promise\ Write stored data for this key. The data must be serializable to JSON. * delete (key: string) => Promise\ Delete stored data by key. ### Storage A key-value storage object for extension targets. Stored data is only available to this specific app at this specific extension target. The storage backend is implemented with \`localStorage\` and should persist across the buyer's checkout session. However, data persistence isn't guaranteed. * read Read and return a stored value by key. The stored data is deserialized from JSON and returned as its original primitive. Returns \`null\` if no stored data exists. ```ts (key: string) => Promise ``` * write Write stored data for this key. The data must be serializable to JSON. ```ts (key: string, data: any) => Promise ``` * delete Delete stored data by key. ```ts (key: string) => Promise ``` ```ts export interface Storage { /** * Read and return a stored value by key. * * The stored data is deserialized from JSON and returned as * its original primitive. * * Returns `null` if no stored data exists. */ read(key: string): Promise; /** * Write stored data for this key. * * The data must be serializable to JSON. */ write(key: string, data: any): Promise; /** * Delete stored data by key. */ delete(key: string): Promise; } ``` ## Related [APIs - StandardApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/standardapi) [APIs - CheckoutApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/checkoutapi) [APIs - OrderStatusApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/orderstatusapi) [APIs - CartLineItemApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/cartlineitemapi) [APIs - PickupPointListApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuppointlistapi) [APIs - PickupLocationListApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuplocationlistapi) [APIs - ShippingOptionItemApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/shippingoptionitemapi) [APIs - ExtensionTargets](https://shopify.dev/docs/api/checkout-ui-extensions/apis/extensiontargets)