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

117
Vistas
Share query result to another component React

I have the query _getCurrentUserInfo with which I get the email of the user who logs into my application in the info variable. I have another component that generates QR, I want to pass the email that I have inside the info variable as a value to generate it. How could I do it? I'm still a newbie, I haven't used redux. Is there a "simple" way?

const _getCurrentUserInfo = async () => {
 try {
  **let info = await GoogleSignin.signInSilently();
  //console.log(info.user.email)**
  const userRol = await AsyncStorage.getItem("user_rol");
  if (!userRol) {
  axios.post('https://ballin-api-stage.herokuapp.com/users',info.user)
  .then((response) =>AsyncStorage.setItem("user_rol",response.data.data.rol))
  .then((error) =>console.log(error))
  }
  else if (userRol==="admin") {
    console.log("admin")
    console.log(userRol)
  }
  else {
    console.log(userRol)
  }
  setUserInfo(info);
} catch (error) {
  if (error.code === statusCodes.SIGN_IN_REQUIRED) {
    alert('User has not signed in yet');
    console.log('User has not signed in yet');
  } else {
    alert("Unable to get user's info");
    console.log("Unable to get user's info");
  }
}

};

export default class QrGenerator extends Component {

constructor()
{
super()
this.state = {
  value: ""
} 
  }
render() {

return (
  <View>
  <QRCode 
  value={this.state.value}
  

/>
</View>
);

Although I have seen that it is not the most correct, I have tried creating info as a global variable, but it could not pass the data. Thank you!

about 4 years ago · Juan Pablo Isaza
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