SolidJSS
SolidJSโ€ข3y agoโ€ข
9 replies
etnbrd

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 ๐Ÿ™
Quickly discover what the solid compiler will generate from your JSX template
Solid is a purely reactive library. It was designed from the ground up with a reactive core. It's influenced by reactive principles developed by previous libraries.
SolidJS
Was this page helpful?