Svelte, Vue, React, Angular Considered Evil: Just Loop Over Signals With A Signal Loop Web Component
Thursday • August 8th 2024 • 10:22:28 pm
I am not entirely serious, but I am not half joking, listen to the following with a sprinkle of salt.
Nor do I seek to start flame wars, don’t hate, learn, build the next svelte or react in a 100 lines of code.
I too have once looked at C, Perl, Jscript, Java, Swing, PHP, .net, ActionScript, NetBeans, Eclipse, anc Chrome with mad lust in my eyes.
Learn, choose wisely,
I am just a little programmer, who is disappointed with the direction runtimes and frameworks are taking.
TypeScript is not JavaScript, and will fail like Jscript and CoffeScript.
And making an un-typed language typed, to make popups is a little silly.
If you need datatypes in your program, as the case may be when reading XML…
Make an object where the key is the property name, and the value, the type you need.
Moreover, Embrace, Extend, Enshitificate and Extinguish, is still on, as evidenced by the blue screens and ads in your task bar.
Not to mention the extra mental workload, distraction, issues with casting, dynamic instantiation, and other things.
But it is not just injecting TypeScript, into places that don’t need it.
React is not reactive, and JSX is an abomination E4X got removed, JSX that demands a parser got praise.
Interweaving the mapping of arrays, with JSX is madness.
Unusual syntax is a big problem, because it will never be portable.
Big blooming ecosystems are precious, I understand that, and the hard work is marvelous.
But 10 lines of subscribing to a signal array, inside a LOOP Web Component of your own making.
Allows for nesting said loop components, as they sit at the HTML element level.
And web components have a proper life cycle, so you can subscribe and unsubscribe from signals.
And when nesting signals, you use a dotted or path notation in the attribute.
Relative paths inside a loop, means the outer loop will assign the signal via a property.
This does ask that you have a tree structure, but that is just nested arrays and signals that may hold signal arrays.
The hygiene and optimizations and browser support of larger frameworks, is again precious and irreplaceable.
But all it takes is a 30 lines of code, to make a simple signal sensitive Web Component.
It will fo logic, looping, and serve as a component, if you state that the template is outside of its body.
So this loop, is a Swiss army knife, that behavies differently based on data type in the signal.
And maybe an optional, template attribute.
Bidirectional data binding is also trivial, as you are ready dealing with signals.
You would scan your template HTML for a data-bind attribute, and setup the binding as needed.
I am a huge fan of svelte, the ideas are lovely.
But with modern browsers everywhere, you need to have clear reasons that your projects really demand.
Otherwise, the fact that web components can be nested, and that they have a life cycle witch works great with signals.
And most importantly, that the signal-loop implementation is just a few lines of code.
Time has come to return to more standard HTML, and more portable and future proof code.
There once was a reason for Angular and React, but that was ages ago, and those reason are gone.
Their ecosystems are beautiful, but they can now be replaced with a few lines of code.