Live data from Hacker News

VanJS – A no-JSX framework based on vanilla JavaScript

vanjs.org

71–80 of 178 posts

Re: VanJS – A no-JSX framework based on vanilla JavaScript

#71
post #31
post #22

Feels weird to seem to seriously represent your framework as being about size without including a comparison to preact - the obvious choice for a react developer looking to reduce their footprint. Preact claims 3kb on their site, and for a 3-4x savings you're going to need to be fairly compelling. I don't mind paying a modest cost for 10x or 100x improvements, but (call it Stockholm syndrome) I like react syntax

Modern reactive UI frameworks get away from maintaining virtual dom. If you want minimalist vdom preact is a great choice. If you'd like to part ways with vdom while keeping jsx, try svelte or solid-js

Preact has signals now too if you're into that.

Re: VanJS – A no-JSX framework based on vanilla JavaScript

#73

Earlier quoted context omitted.

> This is unacceptably huge compared to the similarly named Vanilla JS. It took me a minute to get it. 0 bytes uncompressed, 25 bytes gzipped

Can you enlighten us?

gzip has a fixed header, hence the 25 bytes

Re: VanJS – A no-JSX framework based on vanilla JavaScript

#74
post #16

Why do people even reinvent this wheel every few months? Does the Anyone can build a "reactive" type framework by following tutorials online now, they're super in vogue. Is my cynicism here warranted, or am I just jaded from 20 years of watching pendulums swing left and right and watching the wheel be reinvented over and over?

You're jaded. Look at this as someone completing the exercise to understand reactive frameworks by implementing a toy implementation. Like when someone implements yet another lisp. Maybe you disagree with it getting to front page, but then don't upvote & move on. There'll always be some amount of front page content someone considers crap & it's best if we don't collectively fill every comment thread disparaging about…

> Look at this as someone completing the exercise to understand reactive frameworks by implementing a toy implementation

I don’t think that’s the intention of the author or the person who posted this or the people who voted it to the top of HN

Re: VanJS – A no-JSX framework based on vanilla JavaScript

#75

A lot of the heft of React comes from its optimization and reconciliation code. Looking at the examples on the homepage, I’m struggling to see how this framework would efficiently make updates. It seems like it would just need to update the entire component tree down on any update. For any sufficiently large app this becomes very slow very quickly.

VanJS is a lot faster than React: https://vanjs.org/#performance. UI re-rendering in VanJS is kept at the local level as much as possible, which can be achieved without even the need of vdom

Re: VanJS – A no-JSX framework based on vanilla JavaScript

#76

Earlier quoted context omitted.

> This is unacceptably huge compared to the similarly named Vanilla JS. It took me a minute to get it. 0 bytes uncompressed, 25 bytes gzipped

Can you enlighten us?

It's just regular, already-in-the-browser, JavaScript. 0 bytes to download it.

25 bytes is the size of a gzipped empty file.

Re: VanJS – A no-JSX framework based on vanilla JavaScript

#77
post #8

Why do people even reinvent this wheel every few months? Does the Anyone can build a "reactive" type framework by following tutorials online now, they're super in vogue. Is my cynicism here warranted, or am I just jaded from 20 years of watching pendulums swing left and right and watching the wheel be reinvented over and over?

The problem is not size. The problem is installation, configuration, dependencies, transpilation, IDE setup, etc. And here you have the plain old notepad with browser - nothing else...

[deleted]

Re: VanJS – A no-JSX framework based on vanilla JavaScript

#78

This is unacceptably huge compared to the similarly named Vanilla JS. http://vanilla-js.com/

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*
  *thumbs-down*
15 LoC vs 7 LoC, zero dependencies vs. 0.9kB gzipped or 2.7kB minified. Additional learning curve: 0h vs 1h (allegedly).

Honestly, I am biased and think Vanilla JS wins :D

Re: VanJS – A no-JSX framework based on vanilla JavaScript

#79

This 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.

[deleted]
Post reply on HN