Skip to content

Comment on Solidjs – JavaScript UI Library

Comments

I read this article[0] which was written by the framework’s author. It looks like it gets closer to “reagent in plain Javascript,” which is pretty great.

JS development would benefit greatly from a native “immutable, nestable, performant, deep-compare-by-value” data type that supported something like these operations:

  atom.get(path) 
  atom.set(newValue) // returns new atom
  atom.set(path, newValue) // returns new atom
By handling this type in the JS engine, you can take advantage of HAMT to make this quite performant[1]. The “single-global-state atom” pattern is a point of convergence, and it would be nice to have native speed instead of relying on one of the many libraries that reach for it, each with their own trade offs. (SolidJS uses proxies for this.)

It should be a language-level abstraction. I suspect it would be rapidly adopted by a lot of frameworks, and we’d all benefit from it.

[0] https://javascript.plainenglish.io/designing-solidjs-immutab...

[1] https://en.m.wikipedia.org/wiki/Hash_array_mapped_trie

Isn't immer pretty close?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.