Honestly this just looks a lot like choo, but I’m not understanding where routing happens.
This also looks like something Elm could do better. I don’t see any reason to swap from Elm or React other than the size difference, which Preact already makes up for (3KB)
Your website loads in under a second instead of seconds on dial-up or crappy wireless.
At first glance, this looks similar to https://cycle.js.org which has a similar concept of drivers. I’ve written one app with Cycle, and I really enjoyed the experience. The biggest issue I found was that some DOM APIs really don’t fit the functional reactive model. What is extremely nice about this model is that all data-flow is explicit and “static”: your code really becomes a description of all the ways that data flows around the app, which is really cool.
What I don’t get is why this library needs to define its own view templating language, as it seems only superficially different from say JSX? Haven’t looked very deep so I don’t know if it’s essential. This is something that Cycle is very unopinionated about, which is nice.
Cycle.js looks super interesting. But it looks like it’s at least 10x the size of this. So even if it’s just a more compact implementation of cycle.js, that sounds promising.
It’s similar to Cycle, but it isn’t based on the concept of streams. Instead, an application is just a function of driver inputs and returns driver outputs.
Reading the homepage I can not really distill the benefits of Moon over the rendering model of React. It would be beneficial for our ui libraries to be smaller in kb size, but we shouldn’t underestimate the complexity of state of the art virtual dom rendering. I wonder to what extend Moon can compete with React on performance oriented features (e.g. react fiber or async rendering)
At its core, Moon handles every single side effect with a driver — Moon uses a pretty fast virtual DOM diffing algorithm that performs better than React in benchmarks, but a topic I haven’t covered much is that you can use React with Moon. I haven’t tried it much, but it is pretty simple to make a driver where you can output to React directly and get features like fiber or async rendering.
Can you provide some more details about the benchmarks?
The benchmarks were ran locally on my computer, but benchmarks for previous versions of Moon are available in js-framework-benchmark and there is a PR for the latest version. I’ll update the graphs when it gets merged.
It was merged and the benchmarks were updated! Check out the current results here. Moon is only non-keyed at the moment because you manage local DOM state yourself instead of Moon preserving them through reordering nodes.