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

160
Views
i want to fetch the data to text in react native

I want to fetch the username from data and print it in the screen . I make it in local host of the app but I want to print it like . Welcome (user from data ), I am sure the data is working and the alert is working but i need to make it text not a alert ! if you can help that will be great

my code

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think you should have to define the user property in the State object

class HomeScreen extends Component{
 
 state = { user: ''}
 
 displayData = async () => {
  
  try{
    let user = await AsyncStorage.getItem("UserEmail");
    this.setState({user:user})
  }catch(error){
    alert(error)
  }
}
 
render(){
  return (
   <View>
     <TouchableOpacity onPress={this.displayData}>
       <Text>Click to display data</Text>
     </TouchableOpacity>
     {this.state.user ?  <Text>Welcome {this.state.user} </Text>: null}
   </View>
    )
  }
}
about 4 years ago · Juan Pablo Isaza Report
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!