The general outline of the React Component is as follows:
const API = 'https://min-api.cryptocompare.com/data/histohour?fsym=BTC&tsym=USD&aggregrate=168&limit=168&api_key=90f934173fe9dd81d5acc53f0a9a6c56a9ffcce322e24e722fa842deeff3601b'
class BtcOverview extends React.Component {
constructor(props) {
super(props);
...
this.intPriceData = [];
}
componentWillMount() {
fetch(API)
.then(results => results.json())
.then(marketData => {
var count = 0;
for (let number in marketData.Data){
this.intPriceData.push(marketData.Data[number].close)
};
})
}
When this.intPriceDash
is accessed outside of Fetch()
it returns an array of objects, a snippet of which can been seen in the pic below:
I need a standard Array like this [1,4,6] from the array of objects, however it will not respond to any Object operators I try such as Object.value() and will always return undefined.
I have no idea how to get the values that I need from it and whether there is some issue with the data type.
I can't work with the API data within the Fetch() method as perhaps would be the standard because the code I am working with does not easily accommodate that, hence me trying to access it elsewhere.
Any ideas would be really appreciated. T