Introduction

To learn more about local, session, or memory storage, see wix-storage-frontend.

Get hands-on experience with the Storage API on our Hello Storage example page.

To use the Frontend Storage API, import the needed storage type(s) from the wix-storage-frontend module:

Copy
import { local, session, memory } from "wix-storage-frontend"; // Or one of: import { local } from "wix-storage-frontend"; import { session } from "wix-storage-frontend"; import { memory } from "wix-storage-frontend";
Did this help?

clear( )


Removes all items from local, session, or memory storage.

Method Declaration
Copy
function clear(): void;
Request
This method does not take any parameters
JavaScript
import { local } from "wix-storage-frontend"; // ... local.clear();
Did this help?

getItem( )


Gets an item from local, session, or memory storage.

If an item does not exist, getItem() resolves to null.

Method Declaration
Copy
function getItem(key: string): string;
Method Parameters
keystringRequired

The key of the item to get.

Returns
Return Type:string
JavaScript
import { local } from "wix-storage-frontend"; // ... let value = local.getItem("key"); // "value"
Did this help?

removeItem( )


Removes an item from local, session, or memory storage.

Method Declaration
Copy
function removeItem(key: string): void;
Method Parameters
keystringRequired

The key of the item to remove.

JavaScript
import { local } from "wix-storage-frontend"; // ... local.removeItem("key");
Did this help?