A React component to handle json to csv conversion
npm install react-json-csvInstall the component using NPM:
``sh`
$ npm install --save react-json-csv
Or [YARN]();
`sh`
$ yarn add react-json-csv
`js`
import {
JsonToCsv,
useJsonToCsv
} from 'react-json-csv';
#### JsonToCsv
Converts json to csv file (.csv format) and downloads it
`js`
const filename = 'Csv-file',
fields = {
"index": "Index",
"guid": "GUID"
},
style = {
padding: "5px"
},
data = [
{ index: 0, guid: 'asdf231234'},
{ index: 1, guid: 'wetr2343af'}
],
text = "Convert Json to Csv";
`html`
filename={filename}
fields={fields}
style={style}
text={text}
/>
#### useJsonToCsv
`js`
const { saveAsCsv } = useJsonToCsv();
`html``