4 ms·
Very clickbaity title, this is definitely not "just Javascript you already know": <script> import counts from './store.ts'; import {onMount
by franciscop 3y ago
Very clickbaity title, this is definitely not "just Javascript you already know":
<script>
import counts from './store.ts';
import {onMount} from 'svelte';
</script>
<button on:click={() => $counts.a += 1}>
Increment A ({$counts.a})
</button>
In that tiny snippet there's so many non-js things, like "where did that onMount go?", "why does $counts come from? is it from 'count'?", "how do events work?", "does the onclick update the value later on?", "can I do $counts.a++ instead? once? twice?" etc.
- eyelidlessness 3y agoThat’s not even all. - Why are these ESM imports allowed in a non-module script? - Even if $counts somehow references counts, how is either in scope in any part of button?