summaryrefslogtreecommitdiff
path: root/examples/snowpack/src/components/PokemonLookup.astro
blob: deac184dde21392e5311050ca67f6a5ff73a734a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
export interface Props {
  number: number;
}
const { number } = Astro.props;

const pokemonDataReq = await fetch(`https://pokeapi.co/api/v2/pokemon/${number}`);
const pokemonData = await pokemonDataReq.json();
---

<style>
  .mb1 {
    margin-bottom: 1rem;
  }
</style>

<div class="notification mb1">
  <div class="wrapper">
    Pokemon #{number} is: {pokemonData.name}
  </div>
</div>