etnbrd
etnbrd
SSolidJS
Created by etnbrd on 7/19/2023 in #support
How to add derived values in store after creation
Hey folks 👋 I'm trying to add a derived value after the creation of a store. Like the getter example with createMemo (https://www.solidjs.com/docs/latest#getters), but once the store is created. I know it's possible with createEffect to call setStore to update a part of the store in reaction to another part of the store, but it's not ideal:
it's best to avoid setting signals in effects, which without care can cause additional rendering or even infinite effect loops
And I can't seem to make it work with createMemo. Here is a small playground illustrating the issue: https://playground.solidjs.com/anonymous/d595da0b-9c83-4142-841f-96b6b25c8490 Any idea on how best to implement this? Thanks a lot 🙏
10 replies