Note: Dash.NET is currently considered experimental. If your organization is interested in sponsoring Dash.NET, please get in touch.

DCC.Store.store

The DCC.Store.store component is used to store JSON data in the browser.

For more information and examples, refer to Part 4 of the Dash tutorial on Sharing Data Between Callbacks.

Examples

Share Data Between Callbacks

App
Code

Store Clicks

App
Code

Retrieving the Initial Store Data

If you use the data prop as an output, you cannot get the initial data on load with the data prop. To counter this, you can use the modified_timestamp as Input and the data as State.

Sign up for Dash Club → Two free cheat sheets plus updates from Chris Parmer and Adam Schroeder delivered to your inbox every two months. Includes tips and tricks, community apps, and deep dives into the Dash architecture. Join now.

Storage Limitations

  • The maximum browser storage space is determined by the following factors:
    • Mobile or laptop
    • The browser, under which a sophisticated algorithm is implemented within Quota Management
    • Storage encoding where UTF-16 can end up saving only half of the size of UTF-8
    • It's generally safe to store up to 2MB in most environments, and 5~10MB in most desktop-only applications.
  • modified_timestamp is read only.

Store Properties

Our recommended IDE for writing Dash apps is Dash Enterprise's Data Science Workspaces, which has typeahead support for Dash Component Properties. Find out if your company is using Dash Enterprise.

id (string; required): The ID of this component, used to identify dash components in callbacks. The ID needs to be unique across all of the components in an app.

storage_type (a value equal to: 'local', 'session' or 'memory'; default 'memory'): The type of the web storage. memory: only kept in memory, reset on page refresh. local: window.localStorage, data is kept after the browser quit. session: window.sessionStorage, data is cleared once the browser quit.

data (record | list | number | string | bool; optional): The stored data for the id.

clear_data (bool; default false): Set to true to remove the data contained in data_key.

modified_timestamp (number; default -1): The last time the storage was modified.