React Native Tutorial
- React Native Tutorial
- React Native Environment Setups
- React Native First Application Hello World
- React Native View
- React Native State
- React Native Props
- React Native Style
- React Native Height and Width
- React Native Button
- React Native Layout and Flexbox
- React Native Positioning Element with Flex
- React Native ScrollView
- React Native ListView
- React Native FlatList
- React Native SectionList
- React Native Touchables
- React Native Text Input
- React Native ActivityIndicator
- React Native Picker
- React Native StatusBar
- React Native Switch
- React Native WebView
- React Native ProgressBarAndroid
- React Native ProgressBar With Animated
Navigation
- React Native Navigation
- React Native Configuring Header Bar
- React Native Moving Between Screens
- React Native Passing Value between Screen
- React Native Tab Navigation
- React Native Adding Icons at the Bottom of Tab Navigation
- React Native Create Material Bottom Tab Navigator
- React Native Top Tab Navigator
- React Native Drawer Navigation
Storage
React Misc
- React Native Google Map
- React Native Modal
- React Native Vector Icons
- React Native Splash Screen
- React Native vs. Ionic
- React Native vs. Xamarin
- React Native vs Flutter
- React Native vs React
- React Native vs Swift
- Box shadow in React Native
- React Native IAP
- React-Native Localization
- React Native Toast
- React Native Sound
AsyncStorage Methods
There are various methods of React Native AsyncStorage class which are described below:
Methods
setItem()
The setItem() sets the value for a key and invokes a callback upon compilation. It returns a Promise object.
getItem()
The getItem() fetches an item from a key and invokes a callback upon completion. It returns a Promise object.
removeItem()
The removeItem() removes an item for a key and invokes a callback upon compilation. It returns a Promise object.
mergeItem()
The mergeItem() merges the existing key's value with the input value and assuming both values are stringified JSON. It returns a Promise object.
clear()
The clear() method erases all AsynchStorage from all clients, libraries, etc. It is suggested that don't call this, instead of this you may use removeItem or multiRemove to clear only your app's keys. It returns the Promise object.
getAllKeys()
It gets all the keys which are known to your app, for all callers, libraries, etc. It returns a Promise object.
flushGetRequests()
It flushes any pending request using a single batch call to get the data.
multiGet()
This method allows you to batch fetching of items given in an array of key inputs. The callback method will be invoked with an array of corresponding key-value pairs found:
The method returns a Promise object.
multiSet()
This method is used as a batch operation to store multiple key-value pairs. After the completion of operations, you will get a single callback with any errors:
The method returns a Promise object.
multiRemove()
This method calls the batch deletion of all keys in the key array. It returns a Promise object.
multiMerge()
It executes the batch of operation to merge existing and new values for a given set of keys. It assumes that the values are stringified JSON. It returns a Promise object.