Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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".



No, 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.


Make sure you opt in to use runes!

You can do it project wide or per component: https://svelte-5-preview.vercel.app/docs/runes


> The easiest way to opt in to runes mode is to just start using them in your code.

Opt-in is optional, no?


Whoops, I missed that. Good catch! I'm not sure how tln's problem is happening then.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: