Answers for "react native async storage"

9

react native async storage

yarn add @react-native-async-storage/async-storage

import AsyncStorage from '@react-native-async-storage/async-storage';
// store item
const storeData = async (value) => {		
  try {
    await AsyncStorage.setItem('@storage_Key', value)
  } catch (e) {
    // saving error
  }
}
// get item
const getData = async () => {
  try {
    const value = await AsyncStorage.getItem('@storage_Key')
    if(value !== null) {
      // value previously stored
    }
  } catch(e) {
    // error reading value
  }
}
Posted by: Guest on February-11-2021
1

how to install asyncstorage in react native

npm i @react-native-community/async-storage
Posted by: Guest on September-09-2020
0

react native storage

npm install react-native-storage
npm install @react-native-community/async-storage
Posted by: Guest on January-05-2021

Code answers related to "react native async storage"

Code answers related to "Javascript"

Browse Popular Code Answers by Language