aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/Counter.svelte
diff options
context:
space:
mode:
authorMaksymilian <maks@jopek.eu>2022-09-23 09:44:56 +0200
committerMaksymilian <maks@jopek.eu>2022-09-23 09:44:56 +0200
commit8886308c56223f04df535a065234414a6deb11ba (patch)
treebf432ab5e6a4ae754c4017bd9e0e663c25ccc055 /src/lib/Counter.svelte
downloadsvelte-pokeapi-master.tar.gz
svelte-pokeapi-master.tar.zst
svelte-pokeapi-master.zip
Initial commit, v1.0.0HEADmaster
Diffstat (limited to 'src/lib/Counter.svelte')
-rw-r--r--src/lib/Counter.svelte12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/Counter.svelte b/src/lib/Counter.svelte
new file mode 100644
index 0000000..e417505
--- /dev/null
+++ b/src/lib/Counter.svelte
@@ -0,0 +1,12 @@
+<script>
+ import { getStore } from './hmr-stores';
+ export let id;
+ const count = getStore(id, 0);
+ export const increment = () => {
+ $count += 1
+ };
+</script>
+
+<button class="px-8 py-4 w-52 text-red-500 bg-red-200 rounded-full" {id} on:click={increment}>
+ Clicks: {$count}
+</button> \ No newline at end of file