Skip to content

Instantly share code, notes, and snippets.

@jimmyurl
Last active October 26, 2018 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmyurl/8f05a1308fcdbef11fca119b56cebfa2 to your computer and use it in GitHub Desktop.
Save jimmyurl/8f05a1308fcdbef11fca119b56cebfa2 to your computer and use it in GitHub Desktop.
import React from 'react';
import { Button, View } from 'react-native';
const pressCount = 0;
export default class App extends React.Component {
constructor(props) {
super(props)
this.state = {
pressCount: 0,
}
}
componentDidUpdate() {
console.log('Press Count: ', this.state.pressCount);
}
render() {
return (
<View style={{position: 'relative', top: 100}}>
<Button
title="Press Me!"
onPress={() => this.setState({pressCount: this.state.pressCount + 1})}
/>
</View>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment