Seriously there is zero reason to use monstrous, painful software unless you're a sadist.
Use something like solid or better yet go for a substantially better language like Imba, especially if you're a startup.
Seriously there is zero reason to use monstrous, painful software unless you're a sadist.
Use something like solid or better yet go for a substantially better language like Imba, especially if you're a startup.
Most folks aren’t trying to win a CS purity contest when founding a company.
But that Imba thing? I rewrote this and the kindest I can say is.... I don't see the value add? Learning it isn't going to be transferable?
function signal(value) {
const subs = []
return {
get: () => value,
set: (newValue) => {
value = newValue
subs.forEach(f => f(value))
},
sub: (action) => subs.push(action),
}
}
For building UI, when the component constructor sees a signal object being passed either to a property / children they'll automatically subscribe to the updates of this signal, and update the HTML property / children when there's an update to the signaled value. With this there's almost no overhead beyond setting those stuff yourself with vanilla JS (except for list updates, those still require diffing).Of course Solid's signal implementation is much more robust and have some very mild magic to make the UX better, but the core concept is really simple. Read about Solid's implementation here https://dev.to/ryansolid/building-a-reactive-library-from-sc...
The runtime has to maintain a graph of those signals tree in memory at all time, no? Compared to React that can throw away the vdom after it finished the render.