Skip to content

Save different values on Async Storage React Native

I’m making an app in which I’m trying to save data in the local storage of the phone. I’m using async storage for that but when I try to save a different value with a different key it just updates. Need help, please. Below is my read and write code.

 const storeData = async () => {
try {
  let id = (Math.random() + 1).toString(36).substring(7);
var id33 = id;
  const jsonValue = JSON.stringify(region);
  await AsyncStorage.setItem(id33, "Andres");
} catch (e) {
  // saving error


const fetchAllItems = async () => {
try {
  const keys = await AsyncStorage.getAllKeys();
  const items = await AsyncStorage.multiGet(keys);
} catch (error) {


Thank you and sorry for bothering you.


Before I start console.log(e) your errors in try catch blocks when coding. Will save you time

I made a copy of your code based on the info you gave me, and everything works . Full example here ( Click Editor on the very bottom then turn on panel and then click on logs to see the output.

I got the output so it is showing multiple keys.


I recommned going through every line of your code where you use async storage to see if your missing something. If that still doesn’t fix it delete your node_modules and package-lock.json and run npm install.