Created
May 3, 2018 08:39
-
-
Save ivanbtrujillo/20e05f868fe1f9c6767a3be8d795d3a7 to your computer and use it in GitHub Desktop.
Debugging react native aplication - Medium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { StyleSheet, Text, View, Button } from "react-native"; | |
export default class App extends React.Component { | |
state = { | |
texto: "" | |
}; | |
saludar = () => this.setState({ texto: "Hola, ¿cómo estás?" }); | |
despedirse = () => this.setState({ texto: "¡Nos vemos!" }); | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text>{this.state.texto}</Text> | |
<Button onPress={this.saludar} title="Saludar" /> | |
<Button onPress={this.despedirse} title="Despedirse" /> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
backgroundColor: "#fff", | |
alignItems: "center", | |
justifyContent: "center" | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment