title: How to implement Axios.delete in react and delete from Mongodb by id
body: <p>I am new to MERN (programming itself) , I am trying to make a delete from database by ID from front-end. I would like to be able to click a button on an item and have it deleted from database.</p>
  <pre><code>useEffect(() =&gt;{
    Axios.post('api/product/editProducts')
      .then(response =&gt; {
        if (response.data.success){
          setProperty(response.data.products)
        }else {
          alert('Failed to get product information')
        }
      })
  })
  
  return (
    &lt;div&gt;
      &lt;div style={{ textAlign: 'center', marginTop: '5rem '}}&gt;
        &lt;h1&gt;Edit Properties&lt;/h1&gt;
      &lt;/div&gt;
      &lt;br /&gt;
      &lt;table&gt;
        &lt;thead&gt;
          &lt;tr&gt;
            &lt;th&gt;Product Title&lt;/th&gt;
            &lt;th&gt;Price&lt;/th&gt;
            &lt;th&gt;Title&lt;/th&gt;
            &lt;th&gt;Description&lt;/th&gt;
            &lt;th&gt;Rent/Sale&lt;/th&gt;
            &lt;th&gt;Edit&lt;/th&gt;
            &lt;th&gt;Delete&lt;/th&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
          {Property.map(property =&gt; (
            &lt;tr key={property.id}&gt;
              &lt;td&gt;{property.title}&lt;/td&gt;
              &lt;td&gt;{property.description}&lt;/td&gt;
              &lt;td&gt;{property.price}&lt;/td&gt;
              &lt;td&gt;{property.properties}&lt;/td&gt;                            
              &lt;td&gt;{property.rentorbuy}&lt;/td&gt;
              &lt;td&gt;{EditBtn }&lt;/td&gt;
              &lt;td&gt;&lt;a onClick={handleDeleteProperty}&gt;{DeleteBtn}&lt;/a&gt;&lt;/td&gt;
            &lt;/tr&gt;
          ))}
  </code></pre>
  <p>Using the above code I am able to fetch products from database.</p>
  <pre><code>router.post(&quot;/editProducts&quot;, auth, (req,res) =&gt; {
    Product.find()
      .exec((err,products) =&gt; {
        if(err) return res.status(400).json({ success: false, err})
        res.status(200).json({ success: true, products })
      })
  });
  </code></pre>
  <p><a href="https://i.stack.imgur.com/3lDJm.jpg" rel="nofollow noreferrer">product display</a></p>
  <p>Can someone help me with code and routes of how to click on the delete btn as shown in the picture and have that specific item deleted from the Database?</p>