S
SolidJS2mo ago
lemonad

CreateEffect and store properties

I have a store with a property xyz that is of type undefined | { a: number, b: number} and I ran into something I don't quite understand with createEffect. I pass store.xyz to a component as a prop and on changing the value, this triggers:
createEffect(() => {
console.log(props.xyz)
})
// > Proxy {a: 11, b: 2, Symbol(solid-proxy): Proxy, Symbol(store-node): Object}
createEffect(() => {
console.log(props.xyz)
})
// > Proxy {a: 11, b: 2, Symbol(solid-proxy): Proxy, Symbol(store-node): Object}
while this does not:
createEffect(() => {
console.log(props.xyz === undefined)
console.log("xyz")
})
// No output on change
createEffect(() => {
console.log(props.xyz === undefined)
console.log("xyz")
})
// No output on change
Is there an explanation for this behavior? I'm running 1.7.11 if that helps.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server