this is my first question on stackoverflow, i search and tried lot of solutions but i finally decided to ask for help here.
I have seen a similar question without answer here: Cannot fetch .csv data in React
I use reactJs to create a little application and as a database, i want to use a csv file.
i would like to use the fetch method to parse my data (my csv file),
whatever i do, the console.log(data) who should return me the contents of my csv, rather return anything to me instead....
my code :
async function getData() {
const response = await fetch('./private/BookList.csv', {
headers : {
'content-type': 'text/csv;charset=UTF-8'
}
})
.catch(function() {
console.log("error");
});
const data = await response.text();
console.log(data);
}
in my développer tools , the console.log display this:
which returns me absolutely anything!
my CSV file contain the following lines :
TITRE,EDITEUR,DIMENSIONS ~ (cm),TYPE,COLLECTION,ETAT,PRIX (€),stock HOUSE OF M,PANNINI COMICS,17*26,RELIÉ,MARVEL,COMME NEUF,20,true