Skip to main content

The localStorage object

Store and retrieve data in localStorage.

Use localStorage to save data locally to the browser.

Properties

value
object[]

A list of key-value pairs of data currently stored in localStorage.

Methods

Methods for interacting with localStorage. You can write JavaScript almost anywhere in Retool and use methods to manipulate data or components.

clear()

Clears all keys and values from Retool's localStorage.

localStorage.clear();

setValue()

Store a value in Retool's localStorage.

keyrequired
string

The key name to set.

valuerequired
any

The value to set.

Example

Store localUserCookie value as user.cookieValue.

setValue("localUserCookie", user.cookieValue);