Earlier quoted context omitted.
challenge accepted (app #2, since #1 is just static), BEHOLD: const Counter = () => { let counter = 0; const updCounter = (delta) => { counter += delta; document.getElementById('count').innerText = `♥ ${counter}`; }; document.getElementById('up').addEventListener('click', () => updCounter(1)); document.getElementById('down').addEventListener('click', () => updCounter(-1)); updCounter(0); }; Counter(); *thumbs-up* *th…
Elements with an id are globals, so you do this (not that it's recommended): count.innerText = up.onclick = down.onclick = etc
VanJS – A no-JSX framework based on vanilla JavaScript
91–100 of 178 posts
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#92The library looks nice dx wise but complete lack of any lifecycle hooks is a bummer. I get that minimalism is the core theme but to use any js ui lib that is not explicitly built around the same reactivity model you need to hook into component lifecycle.
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#93This is where most libraries are going. Svelte 5 builds upon these signals / derivations as well, and I guess a bunch of other libraries. It would be time for them to get together and standardize on a signals library at this point that could be adopted to be a web standard and help interoperability between web components built with different frameworks.
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#94Re: VanJS – A no-JSX framework based on vanilla JavaScript
#95This is unacceptably huge compared to the similarly named Vanilla JS. http://vanilla-js.com/
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#96Love the use of functions to craft components. Such an undervalued way of writing a UI.
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#97Re: VanJS – A no-JSX framework based on vanilla JavaScript
#98Earlier quoted context omitted.
Is this the main argument? I think the simplest answer is boundaries. Taking into account how much nesting is involved in writing HTML, it's a clear benefit having a named boundary vs a closing parenthesis.
> Taking into account how much nesting is involved in writing HTML which is another one of its flaws.
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#99I don’t know why they’re selling lack of JSX as a feature. React works without JSX too. It’s just (very convenient) syntactic sugar.
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#100Earlier quoted context omitted.
Agreed. JSX is a bug, not a feature.
... and imposes a build step, for no good reason.