use-csv
v0.0.9
Published
React Hook adaptor of `csvjson-csv2json`
Downloads
26
Readme
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"
/>
);
}