Fetching Data

Here is an example of making an external API call (fetching in the code fence)

bulbasaur

ivysaur

venusaur

charmander

charmeleon

---
import BaseLayout from '../layouts/BaseLayout.astro';

const allPokemonResponse = await fetch(`https://pokeapi.co/api/v2/pokemon?limit=5`);
const allPokemonResult = await allPokemonResponse.json();
const allPokemon = allPokemonResult.results;
---
<BaseLayout title="Data Fetching" >
    <h1>Fetching Data</h1>
    <h3>Here is an example of making an external API call (fetching in the code fence)</h3>
    {allPokemon.map((pokemon) => (<p>{pokemon.name}</p>))}
</BaseLayout>