title: setState on button click and post axios
body: <p>I have this on the front end (react) right now.</p>
  <pre><code>  import '../styles/TourPage.css';
  import React, { Component } from 'react';
  import axios from 'axios'
  
  
  class TourPage extends Component {
    
        constructor(props) {
          super(props);
            this.state = {
              myData: []
            }
      }
  
    componentDidMount() {
  
      axios.get('/getResults')
        .then( res =&gt; {
          console.log(&quot;Res is: &quot;, res.data)
          this.setState({
            myData: res.data
          });
         
        })
        console.log(&quot;res.data&quot;, this.state.myData)
    }
  
    
  
    render() {
      console.log(&quot;res.data&quot;, this.state.myData)
      return (
  
          &lt;table id=&quot;customers&quot;&gt;
                &lt;tr&gt;
                  &lt;th&gt;siteLocation&lt;/th&gt;
                  &lt;th&gt;Services&lt;/th&gt;
                  &lt;th&gt;cnum&lt;/th&gt;
                &lt;/tr&gt;
                {this.state.myData.length &gt; 0? this.state.myData.map((data, index) =&gt; (
            &lt;tr&gt;
           
                    {/* &lt;tr key={index}&gt; */}
                      &lt;td&gt;{data.location}&lt;/td&gt;
                      &lt;td&gt;{data.Services}&lt;/td&gt;
                      &lt;td&gt;{data.cnum}&lt;/td&gt;
                      &lt;button onClick={this.click} disabled={this.state.isLoading}&gt; Delete &lt;/button&gt;
                  {/* {this.state.data} */}
  
                    {/* &lt;/tr&gt; */}
                
            &lt;/tr&gt;
              ))
              : &quot;No Data Found&quot;}
          &lt;/table&gt;
  
      );
    }
  }
  
  export default TourPage;
  </code></pre>
  <p>What I want to do, is on a button click, set <code>data._id</code> in the state, and then call Axios to post it to the Node.JS backend server, so I can update the database. Basically to delete the document. as you can see below, I tried with <code>&lt;a href&gt;</code> but that seems to be an HTML-specific thing. I also tried with the button, but I cannot figure it out. How can I do this?</p>