hello,
I’m trying for several days now to complete my ‘componentDidMount’ function to retrieve my own list of crypto coins.
I added the “key” of each token to my coinData array. this is the most i could get but it still gives me an error : “Unhandled Rejection (TypeError): Cannot read property ‘USD’ of undefined”.
i’m a beginner so please its really working on my nerves.
componentDidMount= async () => {
const coinData = this.state.coinData.map(({name, ticker, price, key}) => {
Promise.all([
axios.get(‘https://api.coinpaprika.com/v1/tickers/’ + key)
]).then((coins)=> {
return {
key: coins.id,
name: coins.name,
ticker: coins.symbol,
balance: 1,
price: formatPrice(coins.quotes.USD.price)
}
})
});
this.setState({coinList:coinData})
}```