by pier25 · 7y ago · 0 comments
Right now you have 1 update operation for an XY translate. What if you wanted to be able to change multiple properties of more complicated classes? You'd need more boilerplate for each update.
Like I said in a previous comment, my favorite approach right now is what Mithril and Imba do: no reactivity. You change your state and when you're done you tell the rendering engine that the state has changed.
https://mithril.js.org/redraw.html
https://www.imba.io/guides/essentials/state-management#state...
Since this is all vanilla you can do pretty much anything you want with your state. Mutable, immutable, etc. You don't need to add the weight and overhead of something like MobX/Redux/Vuex and you can add as much or as little bureaucracy/boilerplate as the project requires.
https://krausest.github.io/js-framework-benchmark/current.ht...
Most importantly Mithril is very lightweight. Check the startup metrics on those benchmarks. This is not a totally fair comparison since Mithril includes a router and an http client and the others do not. Still, it manages to be among the best.
Imba uses memoization and, much like Svelte, direct DOM manipulation.
https://www.imba.io/guides/advanced/performance
Imba was used to build Scrimba (an online code tutorial/editor) which is very impressive.
I couldn't get past the Ruby-esque syntax, but it is a very impressive effort.