score:0
if you are using hooks and usestate, ensure that the url is a string and not resolved as an object before using the data.
score:1
i had the same issue and here's how i solved it. check if the data is in the same directory as the index.html
file. in my case, my index.html
file is in the public/
folder, so i created public/data/data.csv
. you can then try d3.csv('./data/data', function(data){...})
to read in the data.
score:3
you could try using the import statement to load the csv file at first. :)
import react from 'react';
import * as d3 from 'd3';
import data from "./data/data.csv";
class list extends react.component{
componentdidmount(){
d3.csv(data).then(function(d, error){
if (error) {
console.log(error);
} else {
console.log(d);
};
});
}
render(){
return(
<div> </div>
);
}
}
export default list;
Source: stackoverflow.com
Related Query
- event.target.value returns undefined with semantic UI when I console log it
- React Native Clipboard returns different than console log
- The text in Html is not changing even so variable text1 is changing in console log ,why?
- How to console log Index of current image in reactJS
- "left side of comma operator.." error in html content of render
- console log the state after using useState doesn't return the current value
- React. Creating a function that returns html
- How do I display the content of React Quill without the html markup?
- How to get content of Redux store in console without devtools?
- React Ref's offsetheight, always returns '0' for jest test case even after the content is loaded
- How to test HTML content with React testing library
- Remove console log statements in react production build?
- d3.csv returns index.html content in console.log
- Fetch returns html source of the my own index.html
- react-beautiful-dnd: When multiple lists exists, dragging content in one row will drag same index from all rows
- Axios.get returns plain html intead of JSON return data
- ReactTable (ReactJS) - search filtering in row with HTML content does not work
- React js : Rendering multiple index html in a single page applications
- How to create a nested menu using CSV file content
- useState console log return undefined
- Why is value in console log not showing in ReactJS
- Axios returns index.html content to frontend (React.js)
- How to render a html string content in PDF using JsPDF in ReactJS
- How to clear/disable minor and warnings console log error?
- How to render raw HTML content to React pass via props?
- Console log statements on React event handler causes synthetic event warnings
- How to log react console errors to a file?
- How to programmatically show the left most content of the HTML input element when the text is longer than the input itself in React
- How to get console log from axios promise
- ReactJS not compiles boostrap components. only returns HTML components. 0xerr011d
More Query from same tag
- React props comparison: "_.isEqual" versus "==="
- React router Link not causing component to update within nested routes
- React loading initial state
- After installing 'react-navigation' The development server returned response code:500
- How to apply authguard to routes having multiple components in reactjs
- Create Typescript interface with all properties for concrete JSX component
- react-redux: understanding communication between Provider and representational components
- ReactDOM.render issue
- MUIv4 Upgrade w/ TypeScript - Cannot spread props to TextField Properly
- ReactJs: Best Practice of defining event handlers
- React Router: TypeError: Cannot read property 'getCurrentLocation' of undefined
- Change Value of Object Once Added To Array
- Next JS, React have child component tell parent what to render
- React context updating values with Context.Consumer but not with contextType
- Gatsby: tiny-slider-react is giving error at renderToString
- D3 collapsible tree with React: not updating nodes
- Filtering array's object and returning parameters
- Recursion in react component that generates a form
- Using createjs-soundjs in react web app
- Having trouble accessing information from an object to pass as a prop
- Warning: 'A component is changing an uncontrolled input of type text to be controlled' in React.JS
- Re-render same component on url change in react
- Unable to fix React/NextJS memory leak using useEffect() and cleanup function
- How do i generate HTML in React functional component?
- How to use access messages from your passportjs strategy in React
- Server-side rendering with ReactDOM.hydrate
- React: Difference between a Stateful Class Component and a Function Component using Hooks?
- How to fill array of boolean values on checkbox change event?
- Problem in Highlighiting the active page in appbar
- Export a dynamic array from a React component to another component