summaryrefslogtreecommitdiff
path: root/examples/snowpack/src/components/PokemonLookup.astro
diff options
context:
space:
mode:
Diffstat (limited to 'examples/snowpack/src/components/PokemonLookup.astro')
-rw-r--r--examples/snowpack/src/components/PokemonLookup.astro16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/snowpack/src/components/PokemonLookup.astro b/examples/snowpack/src/components/PokemonLookup.astro
new file mode 100644
index 000000000..0de7713e3
--- /dev/null
+++ b/examples/snowpack/src/components/PokemonLookup.astro
@@ -0,0 +1,16 @@
+---
+export let number: number;
+
+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="container">
+ Pokemon #{number} is: {pokemonData.name}
+ </div>
+</div>