Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

118
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda