nirtamir2
Solid.js event handler that depend on reactive value best practice (fix solid/reactivity lint rule)
Hi, I want to know what is the best practice for using event handers in solid.js that depend on reactive variables from different scopes.
I want to create an abstraction over my component library, and I'm unsure what the recommended way is.
I created a counter and 3 buttons that print the counter value onClick.
I want to increase the count and the button to print the latest count. So button 2 does not work well.
But for all the buttons I get lint error.
I added a playground link:
https://playground.solidjs.com/anonymous/f6da6ee2-fe3e-4d99-b840-7e3dbb9eb4e4
How to handle this case?
10 replies
Subscribe to any unknown store change
Hi. Is there a way to subscribe to a store change in unknown property?
I have a store:
And sometimes I modify it
And I want to render it's unwrapped value on each change (and I don't know the change upfront)
How to make the store value reactive to unknown changes?
39 replies
Best practice working with reactive values inside context provider
I did some experiments using solidjs context.
Context as value is not reactive in solid.js.
It's a little different from props that are reactive - if you pass signals as props like
a={a()}
to Child, and access props.a
- a
is reactive.
If I wrap the context value in a function and treat context as Accessor<OriginalContextValue> - it's reactive.
If I use a store it's reactive too (but the update needs to be done differently).
So is it considered good practice to use it with thunk (wrapping in a function)?
4 replies