4 Matching Annotations
- Nov 2021
The consumer component will barely change from our last example. The only difference is the way we'll get a reference to our store (since now the store is exported from the JS module):
Now your whole WS logic can be encapsulated in your JS module. That makes for good separation of concern.
Stores are the idiomatic Svelte way when you need to import "reactivity" from your normal JS sources.
- Svelte: extracting code from components to plain JS modules
- Svelte: reactivity
- separation of concerns
- Svelte: the Svelte way
- refactoring/rewrite: example
- good example
- simple explanation