7 Matching Annotations
- Jul 2025
-
www.loopwerk.io www.loopwerk.io
-
One pattern that I love to use in my SvelteKit projects is returning writable stores from the layout’s load function. This makes it possible to fetch data from the server (for example the user object for the logged in user), and then you make this object available as a writable reactive store throughout the whole application. So when the user updates their username or avatar, you do the PUT request to the server and you get the updated user object back from the server as the response, you can simply update the $user writable store value and every place in your app where you show the user object gets updated immediately.
-
- Jun 2025
-
pinia.vuejs.org pinia.vuejs.orgPinia 🍍1
- Nov 2021
- Oct 2020
-
-
The $ contract for auto-subscribing is lovely in its simplicity and flexibility. You can adapt your own preferred state-management pattern or library, with or without Svelte stores as helpers. Svelte does not fuss about how you want to manage your state.
-
- Sep 2020
-
www.reddit.com www.reddit.com
-
Stores are global state. While context is local state.
-
Notice it's not related to components. Another crucial difference is that it's accessible from outside of components. And good way to determine where goes where is to ask yourself, can this particular state and functionality still makes sense outside of the displayed component?
-