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

116
Views
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
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!