Reputation: 7441
I have a very simple Svelte app that's driving me nuts.
<script context="module">
let data;
const handleClick = async () => {
data = self.crypto.randomUUID()
console.log(data)
};
</script>
<button on:click="{handleClick}">
Click to Load Data
</button>
<pre>
{data}
</pre>
I can't seem to get the vault of data
to render in my page. Just keep getting undefined
. However console.log
is writing out perfectly.
Upvotes: 0
Views: 46
Reputation: 2534
Remove context="module"
. Working repl: https://svelte.dev/repl/501a655e8c2446d5bc2fc1acb1f13990?version=3.50.1
Upvotes: 2