Svelte Store: Store vs Context

Опубликовано: 13 Октябрь 2024
на канале: lihautan
6,061
297

What's the difference between Store and Context?
Why would you want to use store over context, or context over store?

And most importantly, when you should use store, context or both?

---

💻 REPL: https://svelte.dev/repl/0399bbd870524...
https://svelte.dev/repl/cd6cc4a3efbf4... (static global)
https://svelte.dev/repl/9ae99d6ead9c4... (static locals)
https://svelte.dev/repl/6bbf0c6efa434... (dynamic global)
https://svelte.dev/repl/f3fc531a2c424... (dynamic locals)

📚 Related Resources
Svelte Tutorial: Context API https://svelte.dev/tutorial/context-api
Svelte Tutorial: Stores https://svelte.dev/tutorial/writable-...

🥰 Support me https://www.buymeacoffee.com/lihautan

🔗 Want to learn more from me? Check out these links:

Twitter:   / lihautan  
Blog: https://lihautan.com/
Newsletter: https://lihautan.com/newsletter

#svelte #sveltestore

Thanks for watching 🥰 -- with love, Li Hau