UNPKG

react-export-table-to-excel

Version:

It allows you to export an HTML table just by sending the table reference and the name with which you want the file to be saved

18 lines (17 loc) 613 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useDownloadExcel = void 0; const react_1 = require("react"); const lib_1 = require("../lib"); function useDownloadExcel({ currentTableRef, filename, sheet, }) { const [payload, setPayload] = (0, react_1.useState)({}); (0, react_1.useEffect)(() => { setPayload({ currentTableRef, filename, sheet, }); }, [currentTableRef, filename, sheet]); return (0, react_1.useMemo)(() => (0, lib_1.excel)(payload), [payload]); } exports.useDownloadExcel = useDownloadExcel;