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

162
Vistas
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 Respuestas
Responde la pregunta

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 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