Answers for "react native asyncstorage class"

1

asyncstorage react native

yarn add @react-native-async-storage/async-storage // install by yarn
npm i @react-native-async-storage/async-storage // install by npm

// import
import AsyncStorage from '@react-native-async-storage/async-storage';


await AsyncStorage.setItem('@storage_Key', "value") // for store item
await AsyncStorage.removeItem('@storage_Key', "value") // for remove item
Posted by: Guest on April-20-2022
0

react native asyncstorage setItem example

setObjectValue = async (value) => {
  try {
    const jsonValue = JSON.stringify(value)
    await AsyncStorage.setItem('key', jsonValue)
  } catch(e) {
    // save error
  }

  console.log('Done.')
}
Posted by: Guest on March-14-2022

Code answers related to "react native asyncstorage class"

Code answers related to "Javascript"

Browse Popular Code Answers by Language