use-csv
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

useCsv

React Hook adaptor of csvjson-csv2json

install

yarn add use-csv
# or
npm install use-csv

usage

import { useCsv } from "use-csv";
function App() {
  const {
    convertCsv,
    result: { status, json, message },
  } = useCsv();
  useEffect(() => {
    if (status !== "completed") return;
    /** handle the javascript object */
    console.log(json);
  }, [status]);

  return (
    <input
      type="file"
      onChange={(e) => convertCsv(e.target.files[0])}
      accept=".csv"
    />
  );
}

Readme

Keywords

Package Sidebar

Install

npm i use-csv

Weekly Downloads

81

Version

0.0.9

License

MIT

Unpacked Size

17.3 kB

Total Files

8

Last publish

Collaborators

  • jaspilon