background icons
background icons 2

Video Belajar

Tonton dan pelajari berbagai topik menarik melalui video pembelajaran eksklusif dari Channel lihautan.

lihautan

2448

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

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