Nicest way of having computed properties in a store?
I'm trying to model my store in a concise way,
I want to have some base properties, and some computed properties, I think the cleanest way is to use getter/setters but currently they are not reactive as I'm clearly doing something wrong. This is what I have currently:
10 Replies
This is injected into a provider
Seems right to me
I was originally destructuring the state variable that I passed to the context provider, I have since changed that so it just passes
localState
, however it's stil not working:
This only ever gets fired onceyour second parameter doesn't do anything, SolidJS has automatic tracking
remove it or leave an empty array?
remove it, it's not like React
anyways, for your issue, not exactly sure why this wouldn't work. A repro would be great to see
I'll try to do a recreation, give me a few
Must be something else in my application, this works as it should, I'll keep digging:
https://playground.solidjs.com/anonymous/6515f38a-c74d-4b51-b37f-5a2ede1a2005
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Was a damn race condition
Since Getters are working now, is there a concise way to have side effects when the store is updated, withoug having a dedicated createEffect.
I want to be able to call a grpc endpoint on my server when certain state properties are updated.
Side effect when a reactive value changes => createEffect