title: Copy the HTML table to clipboard in reactjs
body: <p>I have an HTML table in my react project. I want to copy the table to clipboard.</p>
  
  <pre><code>&lt;table id="sample"&gt;
   &lt;thead&gt;
    &lt;th&gt;Amount&lt;/th&gt;
    &lt;th&gt;Charges&lt;/th&gt;
   &lt;/thead&gt;
  
   &lt;tbody&gt;
     &lt;tr&gt;{item.Amount}&lt;/tr&gt;
     &lt;tr&gt;{item.Charges}&lt;/tr&gt;
   &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>This is the table structure . I haven't included any react code. </p>
  
  <p>I referred this sample code <a href="https://stackblitz.com/edit/js-copy-element?file=index.js" rel="nofollow noreferrer">https://stackblitz.com/edit/js-copy-element?file=index.js</a> . But it's not in react.</p>
  
  <p>Using react code how can I copy the table to clipboard?</p>