Earlier quoted context omitted.
Try to replicate a sample app made by VanJS with Vanilla JS and check the difference
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…
VanJS – A no-JSX framework based on vanilla JavaScript
81–90 of 178 posts
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#82Earlier quoted context omitted.
That would be Still more readable than brackets hell like: DoStuff(DoMoreStuff(DoEvenMoreStuff()))
^^^ Apples to oranges: vs DoStuff(DoMoreStuff(DoEvenMoreStuff())) Both of them you would split into indented lines when they become too long. And 1 becomes too long much faster. Also with 2 you can do const todo = DoMoreStuff(DoEvenMoreStuff()); DoStuff(todo); where as with 1 you cannot.
const todo = ;
{todo}Re: VanJS – A no-JSX framework based on vanilla JavaScript
#83Earlier quoted context omitted.
What are the long term theoretical benefits of vdom? Concurrent rendering?
At least with solid, you can't do `const a = ` without caveats. Instead you have to store it as `const a = () => ` (which isn't quite the same, having problems managing state/renders). In React I was optimizing things by storing vdom in state/memo & then interpolating that exact vdom. Or sharing vdom in multiple places. Without vdom you can't throw jsx results around so haphazardly In solid there's also managing batc…
Doing a=jsx and interpolation does NOT touch the vdom in any way.
VDOM only comes into play for jsx returned from components before being rendered to screen.
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#84The whole “small footprint” thing is always weird to me. I understand that lots of people really want to squeeze efficiency out of every single kb but Im struggling to see where this is helpful. A single image, a single pixel from the marketing team, the actual application code, the page, etc are all going to dwarf the framework.
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#85Re: VanJS – A no-JSX framework based on vanilla JavaScript
#86Earlier 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…
The fact that you have to manually maintain the binding between states and UI elements and propagate state changes to UI elements is exactly the thing offered by VanJS, or other popular reactive frameworks (despite with a much larger bundle size)
Re: VanJS – A no-JSX framework based on vanilla JavaScript
#87Re: VanJS – A no-JSX framework based on vanilla JavaScript
#88Earlier quoted context omitted.
Try to replicate a sample app made by VanJS with Vanilla JS and check the difference
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…
count.innerText =
up.onclick =
down.onclick =
etcRe: VanJS – A no-JSX framework based on vanilla JavaScript
#89Earlier quoted context omitted.
Size does still matter. Just because we _can_ serve huge amounts of data over the pipe quickly doesn't mean we _should_.
Except... the huge amount is photos and fonts and whatnot. As you can see on the vanjs size, the biggest framework Angular weights 85 kB and it will be cached. Compared to what Angular also brings in functionality, i don't see size of the framework as an argument anymore. Consider Hackernews: hn.js comes with 21,4 kB. The Y logo on the upper left is a 46,32 kB SVG! What should i care about 1kB minimal framework or 85…