DEV Community

Cover image for Svelte stores: console-level & UI-level
LG
LG

Posted on • Edited on

Svelte stores: console-level & UI-level

Vue has Vuex, React has Redux, Svelte has Store . Hereby I just want to stick to practice & share couple of real life examples in Svelte . One important thing to notice, that stores as are lazy , store won't sign contract i.e. won't publish until subscribed .


NOTE : In case codesanbox.com IDE would throw an error on initial load, just try to reload the IDE . It might be buggy sometimes tho !

Svelte store console-level (no UI)


Svelte store UI-level

I used module.export / require (CJS) with ESM export / import as a mixed case for store to import it as .js file , this works on codesandbox , but I somehow found it buggy to run if exported and executed locally , so be advised !


Thanks & see you in the next one!

Top comments (0)