User Manual

Write To Local Storage

19/5/25
Write To Local Storage

Write To Local Storage is an action used to store persistent data on the browser. With this action, data generated as a result of specific user interactions is stored on the device and remains intact even if the browser is closed.

Technical Features

  • Persistent Data Storage: Data remains intact even if the browser is closed.
  • Key-Value Structure: Each piece of data is stored with a key.
  • Data Type Compatibility: Text, numbers, JSON, and other data types are supported.
  • Web & Mobile Compatibility: The action works on both web and mobile projects.
  • Scenario Integration: Stored data can be read and processed later with Read From Local Storage.

Write To Local Storage Action Application Steps

1. Define the Action in UI Design

  • Log in to the Kuika platform.
  • Select the project you want to work on from the Apps screen.
  • Go to the UI Design module.
  • Select the component you want to add the action to (e.g., a button).
  • Open the Properties panel on the right side.
  • From the ADD ACTION menu, select the Local Storage → Write To Local Storage action according to the trigger event you want (Initial Actions, OnClick, OnBlur, etc.).

2. Configure Action Parameters

  • Key (String – Required):
    • The name of the data to be stored in the browser.
    • This key is used to access the same data later.
    • Example: “lastVisitedPage”, ‘userInfo’, “rememberMe”
  • Value (String/JSON/Number – Required):
    • The actual data to be stored.
    • This value can be text, a number, or an object converted using JSON.stringify().
    • Example: user.email, “darkMode”, { name: ‘Ali’, role: “admin” }

Usage Scenario: Saving Dark Theme Preference

When a user selects the dark theme in the interface, this information is written to Local Storage with the key “theme” and the value “dark.” This ensures that the preferred theme is preserved when the user returns to the application.

Application Flow:

  • +ADD ACTION → OnClick → Local Storage → Write To Local Storage
  • Key: “theme”
  • Value: “dark”

Write To Local Storage Action Advanced Customizations

  • Session Persistence: You can store data such as the user's login information so that the application automatically recognizes the user in the next session.
  • Conditional Storage: If the user has checked a checkbox (checkbox.value == true), save the data.
  • Storage with JSON: You can save an object belonging to the user in JSON format and convert it back to an object later. For example, Value: JSON.stringify (name: user.name, lang: “tr” )

Technical Risks and Controls

  • Data Bloat: Excessive data writing can cause performance issues in the browser.
  • Browser Storage Limits: Typically limited to 5-10MB per domain.
  • Format Errors: If JSON data is formatted incorrectly, JSON.parse() errors may occur during reading.
  • Security: Local Storage is an open environment; sensitive data (passwords, tokens) should never be stored in plain text.
  • Key Collision: If data is written to the same key multiple times, the previous data will be overwritten. Ensure that keys are uniquely identified.

The Write To Local Storage action is a powerful tool for making the user experience persistent, preserving session-independent preferences, and increasing the dynamism of your application. It can be easily integrated with scenarios in web and mobile environments and, when used in conjunction with actions such as Read and Delete, provides an effective data management infrastructure.

Other Related Content

No items found.

Glossary

No items found.

Alt Başlıklar