1.0.4 • Published 1 year ago

react-xlsx-export v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-xlsx-export

External libraries such as

  • file-saver: "^2.0.5"
  • xlsx: "^ 0.18.5"

are used as dependencies.

Installation

Install React XLXS Export

with npm

  npm install react-xlsx-export

with yarn

  yarn add react-xlsx-export

Usage

import { useState, useEffect } from "react";
import ReactXlsxExport from "react-xlsx-export";

function App() {

	const [customerData, setCustomerData]: any = useState([]);

	const customers = () => {
		let custs = [];
		for (let i = 0; i <= 25; i++) {
			custs.push({
				firstName: `first${i}`,
				lastName: `last${i}`,
				email: `abc${i}@gmail.com`,
				address: `000${i} street city, ST`,
				zipcode: `0000${i}`,
			});
		}
		setCustomerData(custs);
	};

	useEffect(() => {
		customers();
	}, []);

	return (
		<div>
			<ReactXlsxExport data={customerData} filename="customers" />
		</div>
	);
}

Author