I'm attempting to loop through an array using AlpineJS, but for the life of me, I can't get any output.
I'm hoping someone that is more familiar with AlpineJS may be able to assist.
Thanks in advance.
And here's the code:
<script>
function alpineInstance() {
return {
books: []
}
}
</script>
<div
x-data="alpineInstance()"
x-init="fetch('https://www.googleapis.com/books/v1/volumes?q=Alpine')
.then(response => response.json())
.then(data => books = data)">
<template x-for="(book, index) in books" :key="index">
<div x-text="book.items.volumeInfo.title"></div>
</template>
</div>