How to work with dynamic data?

Trying to understand the library d3js + react. Namely, the dynamic data. Here's a function that gets the data
export function getData() {
 const promiseMSFT = fetch("https://......tsv")
 .then(response => response.text())
 .then(data => tsvParse(data parseData(parseDate)))
 return promiseMSFT;

And here is the component which renders a chart using this data
import { getData } from "./getdata"
class ChartComponent extends React.Component {
 /*componentDidMount function is called after rendering the component*/
 componentDidMount() {
 getData().then(data => {
 /* setState - for asynchronous data updates? */
 this.setState({ data })
 render() {

As I understand it, the graph is based on data obtained in the form of the object. What if I have to give live data for example via sockets? I would appreciate tips and ideas. I do not even know how to approach this task. If I for example I will get data every minute, I do not lose the old data and add new one? I do not even know where to start.
April 7th 20 at 11:07
1 answer
April 7th 20 at 11:09
I do not lose the old data and add new

this.setState({ data: [ newData...]})
// new array [ old data + new data ]

Find more questions by tags ReactD3.js