Alex Lohr
How to share async data inside a context
The problem here is the
const currentPlan = query.plans[0]
, which takes the data out of the proxy that tracks reactive changes. The solution is to return a function instead of a value: const currentPlan = () => query.plans[0]
.6 replies
createSignal vs createStore
That's what I said: try to split up state into multiple signals. Ofc, there may also be the case where a state object changes rarely but the expected changes are large enough to warrant a full re-render in any case. Do not waste time to optimize reactivity that is already sufficiently performant.
6 replies
createSignal vs createStore
I hope this provides an answer: https://dev.to/lexlohr/the-zen-of-state-in-solidjs-22lj
6 replies
Need help to convice developers to go to SolidJS
Look at a component. How many parts of that code actually need to run again and again every time the state changes? I would say less than 25% in most cases.
With React, you usually try to minimize the time spent on this by cutting smaller components, otherwise you get performance issues easily.
With Solid, you know that static parts will be rendered once and never touched again until cleanup. Instead of running component functions again, we only run the parts where changes occur.
However, this means the underlying mindset is completely different. We do not have hook rules since we do not rely on ref counting, but we have props proxies, so we cannot destructure props, lest we lose their reactivity. In React, useState, useMemo and useEffects are trap doors out of re-running code, whlie in Solid, it is the opposite. Also, we can actually manage state pretty efficiently without external libraries.
9 replies