To illustrate the problem i started a new App using the create-react-app tool (from https://github.com/facebook/create-react-app)
I want to be able to load in data from CSV files, I am using the CSV method from d3:
csv('data.csv').then(data => {
console.log(data)
});
I added this function to the App.js file:
import React from 'react';
import './data.csv';
import { csv } from 'd3'
function App() {
csv('data.csv').then(data => {
console.log(data)
});
return (
<div className="App">
</div>
);
};
export default App;
Every time I attempt this the code returns an Array of the Index.html code (pictured) instead of the data in the CSV file. I am sure as to why this is happening?
The CSV file is in the /src folder