title: Taro.removeStorageSync(key)

sidebar_label: removeStorageSync

The synchronous version of Taro.removeStorage.

Reference

Type

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

Parameters

Property Type Description
key string The specified key in the local cache

Sample Code

Example 1

  1. try {
  2. Taro.removeStorageSync('key')
  3. } catch (e) {
  4. // Do something when catch error
  5. }

Example 2

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

API Support

API WeChat Mini-Program H5 React Native
Taro.removeStorageSync ✔️ ✔️