Live data from Hacker News

VanJS (Vanilla JavaScript): smallest reactive UI framework

github.com

61–70 of 214 posts

Re: VanJS (Vanilla JavaScript): smallest reactive UI framework

#61
post #23
post #8

Earlier quoted context omitted.

Yes, please be that guy. Or I'll do it. Vanilla Javascript refers indeed to "javascript without a framework". So creating a framework and calling it "vanilla javascript" is... wrong?

It’s 93 lines, less than most CSS resets. Small enough to copy paste to the top of your index.html in a script tag. You can use it without NPM, webpack, a special compiler pass, or a template language. Seems pretty vanilla compared to the full fat, popular alternatives.

If I tell someone to "just use vanilla js" and they go googling and end up using VanJS instead.... that aint good.

Re: VanJS (Vanilla JavaScript): smallest reactive UI framework

#62

Why is everybody so obsessed with size? 100kB means nothing these days.

i'm also a bit confused why e.g. they have an explicit rule that they only use `let` instead of `const` when declaring variables, "for reducing the bundle size", which seems like a bad trade-off in order to save maybe a couple dozen bytes at most?

Re: VanJS (Vanilla JavaScript): smallest reactive UI framework

#63
post #49

For comparison, similar tiny JS view libraries - https://redom.js.org 2kB - https://nanojsx.io 1kB

nanojsx looks great! I don't really get why mini-van don't use JSX.. Maybe some people just don't want any html tags in their project ? Or maybe their template engine allows a lighter approach.

Re: VanJS (Vanilla JavaScript): smallest reactive UI framework

#64
post #8

I really don't want to be that guy, but... Vanilla JavaScript already exists as a popular term for JavaScript without any framework. No jQuery, no React - just JavaScript. Calling a library VanJS (as short for "Vanilla JavaScript") is just going to cause confusion. The repo's own description uses the phrase vanilla JavaScript in this way, and even mixes both meanings within a single sentence. If the author likes the…

Yes, please be that guy. Or I'll do it. Vanilla Javascript refers indeed to "javascript without a framework". So creating a framework and calling it "vanilla javascript" is... wrong?

Suggestion: call it Bourbon JS. Wikipedia:

> The majority of the world's vanilla is the V. planifolia species, more commonly known as Bourbon vanilla.

Re: VanJS (Vanilla JavaScript): smallest reactive UI framework

#65

I really don't want to be that guy, but... Vanilla JavaScript already exists as a popular term for JavaScript without any framework. No jQuery, no React - just JavaScript. Calling a library VanJS (as short for "Vanilla JavaScript") is just going to cause confusion. The repo's own description uses the phrase vanilla JavaScript in this way, and even mixes both meanings within a single sentence. If the author likes the…

I also thought this was a "joke" on how you don't need a framework. But looks like it is indeed a framework so definitely confusing name.

I do like the idea of it. A lot of value of React for me is in the composition model and could see this being useful for small projects

Re: VanJS (Vanilla JavaScript): smallest reactive UI framework

#66
post #14

The "Hello World" example is a really good example of why React, Vue, etc are better than something more minimal like this library if you're optimizing for speed. The page will show nothing until the script runs, which requires downloading the VanJS lib and the script itself. You could inline them into the page, but that gets seriously messy at scale. A modern React app that's using some serverside rendering for the…

Two way different scenarios where this would be used, so different I wouldn't even compare them.

I'd use this to prototype a basic web interface to interact with something like an IoT device. React would be overkill, and I doubt React would be faster to render than this for that scenario.

On a slow connection, the fully rendered interface could well be more bytes than this plus some data. I would say first to render depends entirely on what you're doing.

React is used in _way_ more places than a blog or ecommerce site.

Re: VanJS (Vanilla JavaScript): smallest reactive UI framework

#67
post #23
post #8

Earlier quoted context omitted.

Yes, please be that guy. Or I'll do it. Vanilla Javascript refers indeed to "javascript without a framework". So creating a framework and calling it "vanilla javascript" is... wrong?

It’s 93 lines, less than most CSS resets. Small enough to copy paste to the top of your index.html in a script tag. You can use it without NPM, webpack, a special compiler pass, or a template language. Seems pretty vanilla compared to the full fat, popular alternatives.

> Seems pretty vanilla

No it doesn't, same as "automobile" doesn't seem pretty Saturn-5, despite the fact that both are moving under their own power.

Terms have meaning, including meaning derived from communities by and large accepting that a certain term has a certain semantic meaning. And the accepted semantic meaning of "Vanilla Javascript" is "runs without a framework besides the browsers own API".

If my code works out of the box in an unmodified browser, then it is Vanilla JS. If I have to load a framework for it to work, then it isn't, period. And it matters exactly nothing whether the framework in question has 900,000 or 9 lines of code.

Re: VanJS (Vanilla JavaScript): smallest reactive UI framework

#68
post #52

Earlier quoted context omitted.

I'd argue that SSR is somewhat orthogonal to React or VanJS. I don't see preliminary reasons to suspect that VanJS will be unable to plug into meta frameworks and eventually get SSR.

There's a bit of work to do to make a JS framework work server side. You need a mechanism to render in Node, which assumes you don't use any browser APIs that aren't available in whatever DOM library you use. Then you need a way to stream the HTML to the client, but that's easy with Express. Then when the page has loaded on the client you need a way to know what the server rendered and attach listeners to the reactiv…

Given that van replace the whole tree each time a value changed, SSR for van is simpler. You run chrome server side, capture the DOM once van has finished its first execution and modify the HTML of the page to includes the new nodes.

Re: VanJS (Vanilla JavaScript): smallest reactive UI framework

#69
post #64
post #8

Earlier quoted context omitted.

Yes, please be that guy. Or I'll do it. Vanilla Javascript refers indeed to "javascript without a framework". So creating a framework and calling it "vanilla javascript" is... wrong?

Suggestion: call it Bourbon JS. Wikipedia: > The majority of the world's vanilla is the V. planifolia species, more commonly known as Bourbon vanilla.

Wait people write JavaScript without drinking bourbon?

Re: VanJS (Vanilla JavaScript): smallest reactive UI framework

#70
post #26

Earlier quoted context omitted.

So now we have a framework that doesn't want to be a framework? They might call it "VoidJS" instead, as in void = vacuum = so lightweight it's almost as if there's nothing there?

Or Null.js. Or undefined.js. And now I want to create a library/framework/whatever called NaN.js...

Would that be equal to zero.js?
Post reply on HN