how to remove an item from AsyncStorage in react-native

后端 未结 7 2962
被撕碎了的回忆
被撕碎了的回忆 2021-02-19 21:56

how to remove an item from AsyncStorage? right now I am trying this code

AsyncStorage.removeItem(\'userId\');

but this is not working for me.

7条回答
  •  再見小時候
    2021-02-19 22:21

    Try this:

    async removeItemValue(key) {
        try {
            await AsyncStorage.removeItem(key);
            return true;
        }
        catch(exception) {
            return false;
        }
    }
    

提交回复
热议问题