I am tring to use react-charts and the object they give as example data looks like this.
chartData: [
{
label: 'Series 1',
data: [
[0, 1],
[1, 2],
[2, 4],
[3, 2],
[4, 7],
],
},
],
I want to build my own "data" and replace this temporary data but the whole object of arrays in objects in arrays (Or whatever it is confuses me.
Can someone explain the nesting here.
Is it an array of 2 objects label and data and data` is an array of key value pairs. Is that accurate?
I'm kind of trying something like this...
let myData = []
res.data.payload.forEach(function (item, index) {
console.log(item, index)
myData[(index, item.odds)]
})
this.setState({ chartData[data]: myData })
Am I even close?
Thanks