import csvData from "./data/normal.csv";
useEffect(() => {
(async () => {
const response = await fetch(csvData);
const data = await response.text();
console.log({ data });
parseCsv(data);
})();
parseCsv(csvData);
}, []);
const parseCsv = (dataCsv) => {
Papa.parse(dataCsv, {
header: true,
download: true,
worker: true,
dynamicTyping: true,
complete: function (results, file) {
console.log(results, file);
},
});
};
Error-----------> enter image description here
Also tried this.....
const parseCsv = (csvData) => {
Papa.parse(csvData, {
header: true,
download: true,
worker: true,
dynamicTyping: true,
complete: function (results, file) {
console.log(results, file);
},
});
};
according to the docs and some exaples online i should be getting a parsed csv file in JSON ormat in the results, but i am unable to debug this error. have also tried directly passing the path in the fetch function, also tried passing the path directly in the Papa.parse(file,config). i am receiving a sting obj with all the data in the console.log. idk, i am just floundering about now.