Skip to main content
Version: Next

Taro.removeStorageSync(key)

The synchronous version of Taro.removeStorage.

Reference

Type

{ (key: string): void; (key: string): void; }

Parameters

PropertyTypeDescription
keystringThe specified key in the local cache

Sample Code

Example 1

try {
Taro.removeStorageSync('key')
} catch (e) {
// Do something when catch error
}

Example 2

Taro.removeStorage({
key: 'key',
success: function (res) {
console.log(res)
}
})
try {
Taro.removeStorageSync('key')
} catch (e) {
// Do something when catch error
}

API Support

APIWeChat Mini-ProgramH5React Native
Taro.removeStorageSync✔️✔️