how to remove an item from AsyncStorage in react-native

后端 未结 7 2955
被撕碎了的回忆
被撕碎了的回忆 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

    Use removeItem() method to remove values from AsyncStorage in react.

    try {
        await AsyncStorage.removeItem(key);
        console.log('Data removed')
    }
    catch(exception) {
        console.log(exception)
    }
    

提交回复
热议问题