Skip to content
Advertisement

Tag: svelte-store

Iterate over Store via Map

Via a Map Objects are added to a Svelte Store. Every object has an ID and it should be possible to iterate over those IDs. With $entities.get(“123”).currentPage; The current Page of this Object is returned. How can I iterate over more than one ID such that the current pages of all objects in the store are returned? Answer You could

Svelte store function update

Svelte store documentation shows String or Integer being updated, but I did not find any dynamic function in store. I don’t understand how to make the getData function as a writable in order to notify the html of the change. In the following sample, I would like b to be shown after the updateKey function is called. You will find

Making class instance reactive in Svelte using stores

I am learning Svelte by creating simple app. The logic is written using classes. The idea is, that all the data needed comes from class instance properties. Instances should not be instantiated more than once. I am using stores to provide components this instances. The problem is I can’t get reactivity using this approach. I tried readable and writable stores

Advertisement