Skip to content

Instantly share code, notes, and snippets.

@TheBojda
Created February 9, 2020 14:02
Show Gist options
  • Save TheBojda/5ae25361ed930453fb4251ea5fcc44f0 to your computer and use it in GitHub Desktop.
Save TheBojda/5ae25361ed930453fb4251ea5fcc44f0 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
export default class App extends Component {
constructor() {
super()
this.state = {text: 'Hello World!'}
}
clickHandler = () => {
this.setState({text: 'Button clicked!'});
}
render() {
return (
<View style={styles.container}>
<Text>{this.state.text}</Text>
<Button title="Push me!" onPress={this.clickHandler}></Button>
</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