Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

111
Views
react-native async storage is not saving and no errors

Async storage is not saving. error is empty

i try to store deviceId in async storage but function setItem is not working

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

const store = async (uniqueId) => { 
const jsonValue = JSON.stringify(uniqueId)
   try {
      await AsyncStorage.setItem("@user", jsonValue, (e,r)=>{ 
        console.log("error: " ,e) 
        return r
      });
   } catch (e) {
      console.log("error: ", e) 
   }
      console.log("get Item: " , AsyncStorage.getItem("@user"))
}
store()
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

getItem is an async function, so you need to add await before like below:

const user = await AsyncStorage.getItem("@user")
console.log("get Item: ", JSON.parse(user))

Or:

AsyncStorage.getItem("@user").then((user)=>console.log(JSON.parse(user)))

But other than that, I think it's not saved when you call it and the way you call the function is wrong.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!