In my code snippet block, I have the following code:
<script setup lang="ts">
import ApiService from '../service/api'
import { reactive, onBeforeMount } from 'vue'
let pokemons = reactive([])
onBeforeMount(async ()=> {
const response = await ApiService.getAll()
pokemons = response.data.results
return pokemons
})
</script>
The issue is that the variable "Pokemons" only exists inside the OnBeforeMount function and not outside of it.
Any advice on how to resolve this?