ReactFix
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • React
  • React Native
  • Programming
  • Object Oriented Programming

Wednesday, November 9, 2022

[FIXED] How to remove an item from AsyncStorage in react-native

 November 09, 2022     asyncstorage, react-native   

Issue

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;
    }
}


Answered By - Himanshu Dwivedi
Answer Checked By - - David Marino (ReactFix Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Post Older Post Home

Featured Post

Is Learning React Difficult?

React is difficult to learn, no ifs and buts. React isn't inherently difficult to learn. It's a framework that's different from ...

Total Pageviews

Copyright © ReactFix