Earlier quoted context omitted.
For arrays, did you end up taking the diffing/memoization approach like solid? I've yet to see any framework have O(1) collection mutation reactivity.
There's no diff. Arrays get proxies just like everything else. For mutations that change the length, extra elements are built or removed at the end. Assignment straight to an index (that doesn't change length) is able to use normal object property semantics. arr.push(e) and arr[i] = e are both O(1). But not all array operations achieve this.
Learn how modern JavaScript frameworks work by building one
101–104 of 104 posts
Re: Learn how modern JavaScript frameworks work by building one
#102Earlier quoted context omitted.
Or, rather than being some great conspiracy, SSR (or as we used to call it, just rendering) makes a great deal of sense. What goes around, comes around. It has always felt like the front-end frameworks, from things like Backbone to React always failed to learn the lessons of history. Preoccupied with being "new" in an area that's rapidly gaining capabilities via the browser. Re-inventing the wheel isn't difficult. Im…
Someone some day should write an article about frameworks with examples that show it's advantages. I just try different things in vanilla depending on the load. In terms of speed nothing can beat just serving a page rendered on the server. If you really need dynamic updates replacing dom nodes is good up to some very limited number, virtual dom and cloned nodes increase this number by a tiny irrelevant amount. If you…
Re: Learn how modern JavaScript frameworks work by building one
#103Earlier quoted context omitted.
There's no diff. Arrays get proxies just like everything else. For mutations that change the length, extra elements are built or removed at the end. Assignment straight to an index (that doesn't change length) is able to use normal object property semantics. arr.push(e) and arr[i] = e are both O(1). But not all array operations achieve this.
Wow, took a look at the ForEach code to better understand. That's a very novel approach.
I have some vague ideas about implementing efficient .splice() calls. Right now knowledge about splicing semantics is lost in between the proxy layer and `ForEach` DOM node array. But I have a bunch of other plans to do first.