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.
Here's what I have under component right now -
<div>
<Button variant="contained"
size="small"
onClick={this.handleExport}>
<SaveIcon label="Export" />
Export
</Button>
</div>
where handleExport generates a csv file using JSON data from backend.
I have tried to use react-csv, react-csv-downloader packages but none of them work for me.
Is there any way I can download the csv file onClick? Sample code would be greatly appreciated.
Thanks!