0.0.3 • Published 4 years ago

react-csv-export v0.0.3

Weekly downloads
67
License
ISC
Repository
github
Last release
4 years ago

react-csv-export

This is react-csv-export for exporting data to csv file

Getting Started

npm install react-csv-export --save

import CsvLink from 'react-csv-export';

Demo

https://cicada1992.github.io/react-csv-export/

Click the Export CSV Button in demo. You can see downloaded csv file.

const EXAMPLE_DATA_OF_DEMO = [
  { id: "id-0", name: "Youngjae", age: 29, country: "KOR" },
  { id: "id-1", name: "Kiook", age: 20, country: "JAP" },
  { id: "id-2", name: "Brian", age: 30, country: "USA" },
  { id: "id-3", name: "Kisoo", age: 41, country: "DPR" },
  { id: "id-4", name: "Youngsik", age: 51, country: "GER" }
];

Props

PropertyTypeRequired?DescriptionDefault Value
dataany[]What you want to export data
filenamestringFilename
withTimeStampbooleanConcatenate utc time stamp behind the file name (example: demo_export_1584169283290)false
skipHeaderbooleanSkip header and export only real datafalse
skipEmptyLinesbooleanSkip Empty linesfalse
onClick() => voidHandler on clicking export link

Example

<CsvLink data={data} fileName="demo_export" withTimeStamp>
  <button>Export CSV</button>
</CsvLink>