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

633
Vistas
AsyncStorage always returns {"_U": 0, "_V": 0, "_W": null, "_X": null}
async function getTokenFromAsync() {
  const userToken = await AsyncStorage.getItem('@User_Token');
  return userToken;
}

export default {getTokenFromAsync};

Im trying to get userToken from asyncStorage but it return me this {"_U": 0, "_V": 0, "_W": null, "_X": null}, Im using react native

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You are not resolving the Promise hence your "weird" output.

This is the way that I have my get Function defined:

  const getData = async (key) => {
    // get Data from Storage
    try {
      const data = await AsyncStorage.getItem(key);
      if (data !== null) {
        console.log(data);
        return data;
      }
    } catch (error) {
      console.log(error);
    }
  };

You can then get the Data by calling the Function with your Key.

  await getData("yourKey")
  .then(data => data)
  .then(value => {
    a state or constant = value
    console.log("yourKey Value:  " + value)
  })
  .catch(err => console.log(err))
about 4 years ago · Juan Pablo Isaza Denunciar

0

You should wait to resolve the promise where you are using it like

getTokenFromAsync().then((userToken)=>{
  console.log(userToken);
});
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