If I have:
-- public
-- csv
exampleCSV.csv
i.e. /public/csv/exampleCSV.csv
and then:
fetch('csv/exampleCSV.csv')
.then(response => {
console.log(response);
response.blob().then(blob => {
let url = window.URL.createObjectURL(blob);
let a = document.createElement('a');
a.href = url;
a.download = 'exampleCSV.csv';
a.click();
});
});
Why do I not get the CSV file on click but instead the html page of the react app?