r/javascript • u/dangreen58 • Oct 23 '26
I spent three years building Nanoviews, a tiny UI library on signals. It just hit 1.0
https://dangreen.blog/post/why-you-should-try-nanoviews/Author here. Nanoviews builds real DOM once, and signals update it in place. No JSX, no virtual DOM. It's around 4 kB gzipped and even runs without a build step. The same weather app weighs 10 kB with Nanoviews versus 66 kB with React. In js-framework-benchmark it comes right behind Solid and Svelte. There's a StackBlitz demo in the post.
74
Upvotes
27
u/speechlessnpc Oct 23 '26
Love seeing view libraries find new approaches to the problem of rendering a reactive UI, but not having html templates is a big no no for me
5
u/optikalefx Oct 23 '26
Reminds me of ExtJS
3
u/Jakeii Oct 24 '26
This looks like the compiled output of svelte
2
u/_Alpha-Ceph_ Oct 23 '26
Did you get inspired by https://vanjs.org/ and how does Nanoviews set itself apart?
2
u/FerLuisxd Oct 27 '26
Is this better than alpinejs?
1
u/horizon_games Oct 26 '26
Hmm interesting, but personally if I was going to use a non-JSX custom sorta-HTML JS-ified lang I'd just use Mithril.js. If I wanted reactivity with normal HTML I'd use Alpine.js. And I love build-less libs.
Looks at least like your tags like p() would tag all existing and future attributes and just pass them through? That'd be a benefit.
6
u/TorbenKoehn Oct 23 '26
Hmmm tries too much to be an own syntax inside JS imho
3
u/eracodes Oct 23 '26
love tiny libraries, but the
Todosexample with the deeply-nested parentheses does not spark joy for me. maybe if there was a constructor layer that could take in an object with meaningfully-named keys. i just think chaining function calls like this gets really opaque really quickly2
u/barake Oct 24 '26
This is a fun library, the API screams for a F# shim. Appreciate you engaging in the thread! I wish more folks would actually answer questions about their posts and explain their thoughts.
1
u/Spare_Message_3607 Oct 23 '26
Looks like a good compliment for Astro, imo. I was never a fan of Alpine syntax.
1
u/sod0 Oct 23 '26
I like it. I think I accidentally build something similar (without signals) when I told my agent to use compossible functions but not framework. Cool idea for sure. Not sure I'm gonna ever use it though.
1
u/haywire Oct 23 '26
Why does anyone care about 56kB?
1
u/_poor 29d ago
Curious what this syntax would look like in Civet.
-11
u/darcygravan Oct 23 '26
what the hell this is shitty.
at least u should give a html based dsl to author template its awful can u even imaging writing templates like that?
no disrespect but i don't think anybody would use that instead of other frameworks what moat does it have?
writing this and creating dynamic dom nodes via vanilla js is the same damn thing.
and even if u give a dsl its still same concept same reactivity carp. if u really wanna make something try some new approach something innovative new out of the box not just yet another clone of react/solid/vue....
0
u/[deleted] Oct 23 '26
[deleted] — view deleted comment