React Hook adaptor of `csvjson-csv2json`
npm install use-csvReact Hook adaptor of csvjson-csv2json
``bash`
yarn add use-csvor
npm install use-csv
`jsx
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 (
type="file"
onChange={(e) => convertCsv(e.target.files[0])}
accept=".csv"
/>
);
}
``