Video details

Svelte Store: Getting the current store value outside of Svelte component

Svelte
03.25.2021
English

If you are used to the $-prefixed variable to access the value of the store, great, but that only works in a .svelte component. Ever wonder how would you do it outside of the Svelte component?
A svelte store is any variable that follows the svelte store contract, which means the only method you can use to figure out the value is the `subscribe` method.
---
đź’»
REPL: https://svelte.dev/repl/c41c57636345460180b2f4db9f1fdf3f?version=3.35.0
đź“š
Related Resources get() https://svelte.dev/docs#get
🥰 Support me https://www.buymeacoffee.com/lihautan
đź”—
Want to learn more from me? Check out these links:
Twitter: https://twitter.com/lihautan Blog: https://lihautan.com/ Newsletter: https://lihautan.com/newsletter
#svelte #sveltestore
Thanks for watching 🥰 -- with love, Li Hau