Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanbtrujillo/20e05f868fe1f9c6767a3be8d795d3a7 to your computer and use it in GitHub Desktop.
Save ivanbtrujillo/20e05f868fe1f9c6767a3be8d795d3a7 to your computer and use it in GitHub Desktop.
Debugging react native aplication - Medium
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