Skip to content

Instantly share code, notes, and snippets.

@cabreraalex
Last active July 15, 2021 22:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cabreraalex/69195baaad8f2d9ed4f1971201c35bda to your computer and use it in GitHub Desktop.
Save cabreraalex/69195baaad8f2d9ed4f1971201c35bda to your computer and use it in GitHub Desktop.
widget-svelte-example App.svelte unit
<script>
import { value, count } from './stores';
let localValue = $value;
</script>
<style>
h1 {
color: purple;
}
</style>
<h1>The value is: {$value} x {$count}</h1>
<input bind:value={localValue} />
<button on:click={() => value.set(localValue)}>Set Value</button>
<button on:click={() => count.update(d => d + 1)}>Update count</button>
@fredhohman
Copy link

Line 16 should be: <button on:click={() => count.update(d => d+1)}>Update count</button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment