[Vuejs]-I can't fetch data from Firebase to Vue

1👍

The issue was on my end, basically unMounted(close) and return anime should be two lines below

export const loadAnimes = () => {
const animes = ref([]) 
const close = animeCollection.onSnapshot(snapshot => {
    animes.value = snapshot.docs.map(doc => ({
        id: doc.id, ...doc.data()
    }))         
})
onUnmounted(close)  
return animes
}

2👍

Are you sure you wrote it in setup()?

setup() {
    onUnmounted(() => {
      ...
    })
}```

Leave a comment