Describe the bug
I can't seem to wrap my head around svelte's new reactivity system.
Below is a simple example, and I don't understand why it is not working. You just create a state class:
class Test {
ready = $state(false);
init() {
this.ready = true
}
}
export const test = new Test();
and import it in the other component.
<script>
import {test} from "./test.svelte"
</script>
<h1>{test.ready}</h1>
<button onclick={test.init}>Click this to set the above to true</button>
But the UI doesn't update.
Reproduction
https://svelte.dev/playground/0d52f8525fbf4e4382eda285c426aec7?version=5.19.2
Logs
System Info
Severity
annoyance