Answer the question
In order to leave comments, you need to log in
How to work with dynamic data?
I'm trying to figure out the d3js + react library. Namely, the question of working with dynamic data. Here is the function that receives the data
......
export function getData() {
const promiseMSFT = fetch("https://......tsv")
.then(response => response.text())
.then(data => tsvParse(data, parseData(parseDate)))
return promiseMSFT;
}
......
import { getData } from "./getdata"
......
class ChartComponent extends React.Component {
/*componentDidMount функция вызывается после рендеринга компонента*/
componentDidMount() {
getData().then(data => {
/* setState - для асинхронного обновления данных? */
this.setState({ data })
})
}
render() {
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question