title: adding a click count to a react native
body: <p>So I am building an app that I want to implement basically a 'like' button on and I can't seem to get the right combination of things to make it work. Basically I want to press a like button and have a number on the page that shows how many times it has been liked. Anyone have any ideas? This is what I have so far:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React from 'react';
  import { StyleSheet,View, Image,TouchableOpacity,Text, StatusBar, 
  ScrollView } from 'react-native';
  
  
  export default class SingleVeg extends React.Component {
    constructor(props){
        super(props)
  console.log("Here", props);
        this.state = {
          data: {},
          count: 0
        }
        this.update = this.update.bind(this)
    }
  
    update() {
         this.setState({ count: this.state.data.count + 1 })
       }
  
  async componentDidMount() {
    const response = await fetch(`https://just-
  ripe.herokuapp.com/vegetable/$ 
  {this.props.navigation.state.params.id}`)
    const json = await response.json()
      this.setState({data: json})
  
  }
  
  render(){
  console.log(typeof this.state.data, this.state.data.id)
    return (
      &lt;View style={styles.container}&gt;
        &lt;View style={styles.image}&gt;
          &lt;Image
          style ={{ width: 350, height: 200
          }}
          source={require("../../images/JustRipe.png")}/&gt;
        &lt;/View&gt;
        &lt;Text style={styles.title}&gt;{this.state.data.title}&lt;/Text&gt;
        &lt;TouchableOpacity style={styles.love} onPress ={this.update}&gt;
  &lt;Text style= {styles.loveText}&gt;Love: {this.state.data.count}&lt;/Text&gt;
  &lt;/TouchableOpacity&gt;</code></pre>
  </div>
  </div>
  </p>