Recently, I started exploring Vue JS and encountered a challenge while looping through API responses using v-for. Below is the snippet from my code:
Get Coins Data
<div v-for="coin in coinsData">{{coinsData.data.coins.name}}</div>
This is how I implemented it in JavaScript:
var app = new Vue({
el: '#app',
data: {
coinsData: []
},
methods: {
getCoinsData() {
fetch("https://api.coinranking.com/v1/public/coins")
.then(response => response.json())
.then(data => (this.coinsData = data));
}
}
})
The API response that needs to be looped through can be found at . It's pretty extensive, so I haven't included it here :)