$state the new store ? #10262
Replies: 3 comments 4 replies
-
+1 this question. I'm considering open-sourcing our store helper library, but if stores won't be a large part of svelte 5 I'd rather wait for runes to stabilize before releasing anything. |
Beta Was this translation helpful? Give feedback.
-
I have done some playing around with state in a try out app, and so far it seems like $state can be used like stores, but with the additional benefits of not needing special syntax/methods (can be used just like any object) and fine-grained nested reactivity - I'm even starting to wonder if a whole app can be driven by a single $state. |
Beta Was this translation helpful? Give feedback.
-
I don't see stores going anywhere as
For However, I haven't really played with Svelte 5, so maybe all of this is actually possible with |
Beta Was this translation helpful? Give feedback.
-
I was under the impression that $state are meant to replace stores. Yet, if they can't be used in normal js/ts files (e.g. to run unit tests), their usability seems quite limited. I think a comparison table would be helpful when to use a store vs state.
Also, will stores also gain deep fine-grained reactivity in svelte 5 ?
I guess $state is a compiler level feature, but I'm wondering if it would be truly impossible to make it importable so it can be used in any js files, rendering stores obsolete while allowing for straightforward use with TDD.
Beta Was this translation helpful? Give feedback.
All reactions