Why is setting a store value in load function bad?

jimnayzium

Jim Nayzium

Posted on August 9, 2024

Why is setting a store value in load function bad?

Per the sveltekit documentation and the tutorial, it says, "You may be tempted to do this," and then it shows an example of a store value being set inside a load function on your +page.js. It goes on to say that value will be available to all users, and that has confused me.

My particular application needs are solved mosts conveniently by setting a store's value in the +layout.js file, and then dozens of small components reference that store's values instead of always having to every time I use and re-use these components.

I am just confused how setting the store value in the load function on the client side would impact all the users. It reads confusing.

Can someone explain what they mean?
Thanks.

đź’– đź’Ş đź™… đźš©
jimnayzium
Jim Nayzium

Posted on August 9, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related