1yarn add @react-native-async-storage/async-storage
2
3import AsyncStorage from '@react-native-async-storage/async-storage';
4// store item
5const storeData = async (value) => {
6 try {
7 await AsyncStorage.setItem('@storage_Key', value)
8 } catch (e) {
9 // saving error
10 }
11}
12// get item
13const getData = async () => {
14 try {
15 const value = await AsyncStorage.getItem('@storage_Key')
16 if(value !== null) {
17 // value previously stored
18 }
19 } catch(e) {
20 // error reading value
21 }
22}
1npm install react-native-storage
2npm install @react-native-community/async-storage
3