const props{
csvData: events[]
}
<CSVLink data={csvData}>Download me</CSVLink>;
I am trying to use react-CSV and export table as CSV but the initial value of the event is empty and CSVLink throwing error of undefined value
One solution would be to conditionally render the CSVLink component once there is csvData available.
const props{
csvData: events[]
}
if (csvData?.length > 0) {
return <CSVLink data={csvData}>Download me</CSVLink>;
}
return (<p>Waiting for data...</p>)