export-data
Export data in React to CSV and other file formats
Docs
FileDownloadLink
Example
<FileDownloadLink
fileType="CSV"
filename="fruits"
data={{
columnNames: ["Fruit", "Price"],
rows: [
["Apple", 1],
["Watermelon", 5],
["Durian", 10],
],
}}
>
Download data
</FileDownloadLink>
Props
export type FileDownloadLinkProps = {
fileType: FileType;
encoding?: string;
data: FileDownloadLinkData;
filename?: string;
onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
setsDataAsyncInOnClick?: boolean;
children: React.ReactNode;
};
export type FileDownloadLinkData = {
columnNames: (string | number)[];
rows: (string | number)[][];
} | null;