Local Storage
Last updated
Last updated
© 2024 UI Bakery
localStorage
is permanent browser storage, which is available across all browser tabs of your application and after the page refresh. You can find more details about it here.
localStorage can be used as a temporary storage in the following cases:
the data needs to be saved after a page refresh;
the data needs to be available across all browser tabs.
To save the data to the localStorage
, use the action Save to Local Storage, and assign your variable a name. To use the data from it, use {{localStorage}}.getItem('varName')
, where varName
is the name of the variable used in the action.
Let's check the localStorage
usage on a simple example. We will add a text area component and save a draft of the message so that it's not lost upon a page refresh or when a user closes the app.
Start with adding a text area component onto the working area.
Next, add a new action - Save to local storage. Specify the variable name and the value, and assign the action to the OnChange trigger of the text component\
Finally, assign the localStorage
variable to the Value filed of the text:\
Method | Description |
---|---|
| Retrieves the value associated with the specified key. |
| Adds key's value or updates key's value if it already exists. Method throws error when size quata exceeded. |
| Removes the key-value pair with the specified key. |
| Clears all key-value pairs stored in |
Example usage: