React-Data-Export
A data export library built with and for React.
Getting Started
import React from "react"
import * from "react-data-export"
const dataSet1 = [
{
name: "Johson",
amount: 30000,
sex: 'M',
is_married: true
},
{
name: "Monika",
amount: 355000,
sex: 'F',
is_married: false
},
{
name: "John",
amount: 250000,
sex: 'M',
is_married: false
},
{
name: "Josef",
amount: 450500,
sex: 'M',
is_married: true
}
];
class App extends React.Component {
render() {
return (
<ExcelFile>
<ExcelSheet data={dataSet1} name="Employees">
<ExcelColumn label="Name" value="name" />
<ExcelColumn label="Wallet Money" value="amount" />
<ExcelColumn label="Gender" value="sex" />
<ExcelColumn label="Marital Status"
value={(col) => col.is_married ? "Married" : "Single"} />
</ExcelSheet>
</ExcelFile>
);
}
}
Dependencis
This package uses file-saver and xlsx and using json-loader will do the magic for you.
vendor: [
.....
'xlsx',
'file-saver'
],
.....
node: {fs: 'empty'},
externals: [
{'./cptable': 'var cptable'},
{'./jszip': 'jszip'}
]