title: How to export csv object in react
body: <p>I am trying to figure out if there is any way I can download a csv file onClick of the EXPORT button on my webpage using react.</p>
  
  <p>Here's what I have under component right now - </p>
  
  <pre><code>&lt;div&gt;
      &lt;Button variant="contained" 
          size="small" 
          onClick={this.handleExport}&gt;
          &lt;SaveIcon label="Export" /&gt;
          Export
      &lt;/Button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>where handleExport generates a csv file using JSON data from backend. </p>
  
  <p>I have tried to use react-csv, react-csv-downloader packages but none of them work for me.</p>
  
  <p>Is there any way I can download the csv file onClick? Sample code would be greatly appreciated.</p>
  
  <p>Thanks!</p>