I'm very new to vue. what I'm trying to do is have a loading gif while waiting for the endpoint to return.
I'm trying to use watchEffect, but I can't figure it out. If it's the right way how do I do it? If not what should I use instead?
Thanks
EDIT: Code
<template>
<div class="player-list" :key="playerList.id" v-for="playerList in players.playerLists">
<PlayerList :playerList="playerList" />
</div>
</template>
<script>
import getPlayers from "@/composables/getPlayers";
import PlayerList from "@/components/PlayerList";
import { watchEffect } from 'vue';
export default {
name: 'PlayerLists',
components: {
PlayerList
},
setup() {
const { players, error, load } = getPlayers() //request endpoint
load()
watchEffect(() => {
console.log('watch effect function')
})
return { players, error }
}
}
</script>