etnbrd
etnbrd
SSolidJS
Created by etnbrd on 7/19/2023 in #support
How to add derived values in store after creation
Ah, yes, sorry if that wasn't clear 😅
10 replies
SSolidJS
Created by etnbrd on 7/19/2023 in #support
How to add derived values in store after creation
This snippet doesn't work, because it's overriding an existing property of the store, which is not permitted, I guess. It should work on a new property, though:
const [count, setCount] = createStore({primary: 1})
const memo = createMemo(() => count.primary + 3);
setCount('derived', {
memoDerived: {
get get() {
return memo();
}
}
});
count.derived.memoDerived.get
const [count, setCount] = createStore({primary: 1})
const memo = createMemo(() => count.primary + 3);
setCount('derived', {
memoDerived: {
get get() {
return memo();
}
}
});
count.derived.memoDerived.get
10 replies
SSolidJS
Created by etnbrd on 7/19/2023 in #support
How to add derived values in store after creation
I'm kind of wondering why it works, though 😅
10 replies
SSolidJS
Created by etnbrd on 7/19/2023 in #support
How to add derived values in store after creation
Ah! Interessting! Thanks 🙏
10 replies
SSolidJS
Created by etnbrd on 7/19/2023 in #support
How to add derived values in store after creation
Thanks for your reply 🙏
10 replies