I've been thinking and experimenting with re-rendering the whole DOM[1]. I'm aware there are libraries for merging DOM trees, but I'm limiting the project to native APIs. I'm following React's declarative model with a 10 LoC React.createElement implementation. Since there's no native DOM merge API, I'm mutating the DOM in two places, but reusing the components.
So far, I believe that given a merge DOM function or native API, we can get the benefits of React with a few utilities.
efortis•1h ago
I've been thinking and experimenting with re-rendering the whole DOM[1]. I'm aware there are libraries for merging DOM trees, but I'm limiting the project to native APIs. I'm following React's declarative model with a 10 LoC React.createElement implementation. Since there's no native DOM merge API, I'm mutating the DOM in two places, but reusing the components.
So far, I believe that given a merge DOM function or native API, we can get the benefits of React with a few utilities.
[1] https://github.com/ericfortis/mockaton/blob/main/src/Dashboa...
---
> Is there a better model?
IMO, React class components with something like Meteor’s ReactiveVar for state. Here’s an implementation for that standalone state:
https://github.com/uxtely/js-utils/tree/main/reactive-state