Search code examples
react-nativeasyncstorage

How to remove an item from AsyncStorage in react-native


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

AsyncStorage.removeItem('userId');

but this is not working for me.


Solution

  • Try this:

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