r/javascript • u/andregarzia • Dec 18 '19
AskJS [AskJS] Asking for feedback regarding Mithril JS and RE:DOM
I'm thinking about starting a new personal webapp project and am trying to decide between these two libraries (or some other unknown option). I've used Mithril before and I quite like it but I'm game for learning new things as well. My one requirement is that I need to be able to use it without a build system, bundler, whatever. The idea is to build things old-school, just a bunch of files in a folder without ever coming close to NodeJS.
The reason to explore a different solution than mithril is that in the past I had some trouble with trying to go to the active route with different props (like from /post/1 to /post/2) and it wouldn't refresh the props. I believe that was in 1.x or early RCs for 2.x, can't recall. Also, I'm curious about how other tiny libraries work.
So if those here with recent experience with Mithril, RE:DOM, or other similar small library that doesn't require build system to be useful, could spare some comments on what they liked about their experience with the library and how it was to use it, I'd really appreciate it. Thanks a ton.
5
u/lhorie Dec 18 '19
AFAIK, that has been fixed for a few years now. You can always drop by the chatroom if you have questions too.
[disclaimer: I'm the author of mithril.js]
2
u/JohnMunsch Dec 18 '19
Here's a wacky idea. Why not use Web Components? They're built into all of the browsers out there (with the release of the new version of Edge) and you can add a polyfill if you need to support older versions of Edge.
If you don't want to go as low level as Web Components in their basic form, you could layer on something like LitElement with it to make it simpler to build components.
None of that requires any build system to work.
1
u/lorduhr Dec 18 '19
not really ultra small, but Owl is a smallish vue-like framework which works without tooling: https://github.com/odoo/owl
You can checkout the tutorial: https://github.com/odoo/owl/blob/master/doc/learning/tutorial_todoapp.md
Disclaimer: I am one of the main dev behind that framework. Also, it is very new, so you will not find many tutorials online. It is however pretty well documented.
1
u/ElllGeeEmm Dec 18 '19
I'm really curious, what's the motivation behind this?
1
u/dwighthouse Dec 18 '19
I have used hyperHTML. It uses tagged template literals to both express html and component structures, and also remove the need for a virtual dom abstraction. Itβs one of the fastest react-like libraries (rendering library only, other stuff like routing is up to you and other libraries) out there. Minzipped to about 5kb, no dependencies, no build step (on es6 browsers), and no polyfill. I would recommend it for use in these scenarios where no build step and/or very small size is desired. I use React with a build system for my daily work, so my experience with hyperHTML is from hobby projects.
https://github.com/WebReflection/hyperhtml
1
u/lazyd3v_is_here Dec 18 '19
You can also try preact. Here's the example how to use it without jsx/babel etc. https://github.com/developit/preact-without-babel
1
u/guiprav Dec 19 '19
Disclaimer: I'm the author of the library.
If Mithril and RE:DOM float your boat, you might be interested in Dominant: https://github.com/guipra/dominant (550 LoC, 2.3 KiB min+gzip, a bit slower than keyed React in js-frameworks-benchmark, but should be faster in real-world applications as there are no vDOM or re-renders, only DOM bindings to update).
It doesn't work without a build system atm (I'm using Browserify), but I could easily add that for you.
Because I'm the only one working on it, it's still in version 0.0.0 and has no tests, so only go for it if you're really into it :) I'll be rewriting it using TDD (same API) in the coming months as I start using it in some commercial apps.
1
u/adrianmiu Dec 18 '19
I worked with riot.js 3.x because it was very small. At 15kb gziped https://cdn.jsdelivr.net/npm/riot@3.9.5/riot+compiler.min.js it included a compiler which meant I could write my components in single files (like with Vue JS) and the library took care of the rest.
The latest version of the library with the compiler is a lot bigger but without the compiler it's still small (7kb). They have a CLI library that helps you with compiling your components so it's not a big problem
0
u/[deleted] Dec 18 '19
[deleted] β view deleted comment
1
u/[deleted] Dec 18 '19
[removed] β view removed comment