I'm trying to generate a random quote from data obtained through an api. I generated a random index but when I click on the corresponding button I'm not getting back a random quote. I'm not getting any apparent errors.
randomQuote() {
const index = Math.floor(Math.random() * this.quotes.length);
return this.quotes[index]
},
Here's my data object.
data: {
data: [],
quotes: [],
currentIndex: 0,
currentPage: 1,
},
Here's my axios call:
axios.get(url).then(res => {
this.data = res.data;
this.quotes = this.data;
});