SolidJSS
SolidJSโ€ข4y agoโ€ข
3 replies
bigmistqke

setting getter in store on already defined key loses reactivity

const [store, setStore] = createStore({ value: 0, alreadyDefinedKey: {}});

setStore('newKey', {
 get get() {
   return store.value
 }
})

setStore('alreadyDefinedKey', {
 get get() {
   return store.value
 }
})


in the above example store.alreadyDefinedKey.get will not update its value when store.value gets updated. is this expected behavior? can we only set getters when initializing its parent?
https://playground.solidjs.com/anonymous/972b3aec-d7df-4ec0-9a68-c8b8b60785e3
Quickly discover what the solid compiler will generate from your JSX template
Was this page helpful?