ReactNativeAsyncStorage interface

Interface for a suppliedAsyncStorage.

Signature:

exportinterfaceReactNativeAsyncStorage

Methods

MethodDescription
getItem(key)Retrieve an item from storage.
removeItem(key)Remove an item from storage.
setItem(key, value)Persist an item in storage.

ReactNativeAsyncStorage.getItem()

Retrieve an item from storage.

Signature:

getItem(key:string):Promise<string|null>;

Parameters

ParameterTypeDescription
keystringstorage key.

Returns:

Promise<string | null>

ReactNativeAsyncStorage.removeItem()

Remove an item from storage.

Signature:

removeItem(key:string):Promise<void>;

Parameters

ParameterTypeDescription
keystringstorage key.

Returns:

Promise<void>

ReactNativeAsyncStorage.setItem()

Persist an item in storage.

Signature:

setItem(key:string,value:string):Promise<void>;

Parameters

ParameterTypeDescription
keystringstorage key.
valuestringstorage value.

Returns:

Promise<void>

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-01-19 UTC.