3 ms·
I recently wrote a game in Svelte 4, and went through a transition from using the <script>/$ reactivity to stores. This looks MUCH nicer to deal with. Their ex
by tln 3y ago
I recently wrote a game in Svelte 4, and went through a transition from using the <script>/$ reactivity to stores. This looks MUCH nicer to deal with.
Their examples seem to be missing some imports? Trying to use $state as shown with svelte@5.0.6 gives "ReferenceError: state is not defined".
- benmccann 3y agoNo, runes like $state do not need to be imported. They're similar to import() that they look similar to functions, but are keywords built into the language.
- onsclom 3y agoMake sure you opt in to use runes! You can do it project wide or per component: https://svelte-5-preview.vercel.app/docs/runes https://svelte-5-preview.vercel.app/docs/runes