Skip to content

Instantly share code, notes, and snippets.

@r3dm1ke
Last active February 25, 2020 17:03
Show Gist options
  • Select an option

  • Save r3dm1ke/1e9b3c5ac9c043cc81a4d272c481c4fe to your computer and use it in GitHub Desktop.

Select an option

Save r3dm1ke/1e9b3c5ac9c043cc81a4d272c481c4fe to your computer and use it in GitHub Desktop.
import React, {useState} from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
export default function App() {
const [counter, setCounter] = useState(0);
return (
<View style={styles.container}>
<Text
style={styles.label}
testID={'counter'}
>
You clicked the button {counter} times.
</Text>
<Button
testID={'button'}
onPress={() => setCounter(counter + 1)}
title={'Press me'}
/>
</View>
);
}
const styles = StyleSheet.create({
label: {
marginBottom: 16
},
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