Search.../

getItem( )

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

Description

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

Syntax

function getItem(key: string): string

getItem Parameters

NAME
TYPE
DESCRIPTION
key

string

The key of the item to get.

Returns

The retrieved item value.

Return Type:

string

Related Content:

Was this helpful?

Retrieve an item from local storage

Code Example

Copy Code
1import {local} from 'wix-storage';
2
3// ...
4
5let value = local.getItem("key"); // "value"
Retrieve an item from session storage

Code Example

Copy Code
1import {session} from 'wix-storage';
2
3// ...
4
5let value = session.getItem("key"); // "value"
Retrieve an item from memory storage

Code Example

Copy Code
1import {memory} from 'wix-storage';
2
3// ...
4
5let value = memory.getItem("key"); // "value"