Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

112
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda