We shipped a very major product (300 person company) on Mithril.js a few years back when React was young and Angular was the go-to in this space.<p>We had a fairly positive experience, but ran into enough problems here and there with vdom rendering bugs that we eventually decided to rewrite the entire product 4 years later in React.<p>Certainly, it did was it was supposed to very well, until we really pushed it to its limits with vdoms that were complex and mutating in real time. Then we broke it non deterministically and couldn't reliably reproduce the issues that we were having each time for a solid bug report. Couldn't really even reproduce them consistently in production, they would just happen in random places.
Right now Next.js might be the hottest front end framework but I'm looking for something simpler to build SPA's. I'm not interested in SSR or SSG at all. Mithril.js looks very promising as it provides you with everything you might need to build a simple web app out of the box. The only other frameworks that do that is Angular and Ember, but they're both declining in popularity especially Ember. On the other hand React.js has CRA that is very complicated and doesn't even come with routing out of the box. Is there any other good and modern SPA framework out there?
I like to chime in every time I see a thread about Mithril. I learned modern SPA development with Mithril and in many ways still prefer it over React or Svelte.<p>It's definitely starting to show its age as many of the main contributors have moved on and new libs are being created everyday. However the chat [1] is still very active and there are always great discussions going on there that are often not even specifically about Mithril. One of the best dev communities I've found, honestly.<p>One major benefit of Mithril for me is the lack of need for polyfills while still including a router, XHR utils, and simple state management, AND being compatible with IE11 out of the box, which is invaluable for many government contracts I work on where I don't want to introduce any potentially complicated build tools to an already complex codebase.<p>[1] <a href="https://gitter.im/mithriljs/mithril.js" rel="nofollow">https://gitter.im/mithriljs/mithril.js</a>
I used to use mithril for almost every new project I'd start, but I've switched over to using React w/ Hooks for just about everything for two main reasons:<p>- toolchain support is a lot less finicky and better supported (you can use parcel and it "just works")
- should I need to bring in a obnoxious third party library, it's far more likely to exist in a react world than mithril<p>If you're just building something small / on your own, mithril is definitely worth a shot though, it's relatively pleasant to use and packs in some very handy XHR related helpers
If you want to try mithril in a mid-sized project, sure do it, cause it is a nice, free as in freedom library to render vdoms without imposed opinion on how to manage state. But be aware that it has no error handling around view() method and any error thrown from there will irreversibly break mithril internals everywhere on the page, this is by design. Second thing, I didn’t push it to the limit as another commenter, but massive vdoms (many tens of thousands of vnodes) are slow to even rebuild and compare, so you’ll have to use lazy techniques described in docs. It is not exclusive to mithril, but worth knowing. Otherwise, mithril is basically a core vdom tech similar to vue and/or react, wish these two had their render cycles as separate packages. Also, if someone knows a cheap way to turn react into mithril’s spirit, e.g. via light setState-detaching layer, please share.
Mithril is the React Facebook would have written if its devs didn't have too much time on their hands - it's wonderfully simple.<p>I stole their API somewhat for my 33-line-React, if you have any interest in how stuff works under the hood - check it out! <a href="https://leontrolski.github.io/33-line-react.html" rel="nofollow">https://leontrolski.github.io/33-line-react.html</a>
Just in case someone interested.<p>Mithril works as it is in Sciter.JS<p>Yet this:<p><pre><code> JSX = m; // let's use Mithril as a driver of JSX expressions
</code></pre>
enables built-in and native Sciter's JSX extension to work with Mithril:<p>See demo: <a href="https://github.com/c-smile/sciter-js-sdk/blob/main/samples/mithril/JSX/mithril%2Bjsx.htm" rel="nofollow">https://github.com/c-smile/sciter-js-sdk/blob/main/samples/m...</a><p>Sciter.JS uses QuickJS with JSX parsing extension added : <a href="https://github.com/c-smile/quickjspp/blob/master/quickjs-jsx.h" rel="nofollow">https://github.com/c-smile/quickjspp/blob/master/quickjs-jsx...</a> . It is significantly easier and effective to add JSX as part of native JS parser rather than to have monstrous JS-parser-in-JS infrastructure of Babel.
I have noticed newer generations of developers believe they need heavy frameworks like React to develop web applications. Most apps don't need such heavy frameworks. Here's a 500-line "framework" (if you can call it that) <a href="https://github.com/Rajeev-K/mvc-router" rel="nofollow">https://github.com/Rajeev-K/mvc-router</a> and here's an example app built using it: <a href="https://github.com/Rajeev-K/eureka" rel="nofollow">https://github.com/Rajeev-K/eureka</a> For templates I used <a href="https://github.com/wisercoder/uibuilder" rel="nofollow">https://github.com/wisercoder/uibuilder</a> which is a 200-line lib. This is about as "close to the metal" as you can get, and still be productive.
I’ve never used Mithril but in looking over this it seems very similar to a small library I wrote myself, especially with regards to routing and the use of # in the URI. I think solutions to certain problems are universal and the way we implement those solutions is the interesting part. Of course my library was never optimized for large-scale DOM mutations or other such real-world issues, but it’s always fascinating to see someone develop similar solutions. So why did I even write my own library? It was more out of curiosity than need. I also like to understand how “magical” things work, and for me, the best way to understand something is to try to do it myself, even if I don’t end up fully completing whatever “it”
is. Discovery is a powerful benefit that I feel modern software engineering doesn’t provide as much as it used to.
I was an avid user of Mithril several years ago and even connected with one of the maintainers on LinkedIn. However, I ran into issues (I forget what they were at this point) building v1 of my social network and eventually found Svelte.<p>Mithril still has a place in my heart though, it was a joy to use.
Mithril is really special among JS frameworks. It has a very tiny API and thus the resulting components are powerful and highly reusable. I think of them as Lego bricks to build worlds inside browsers. Whenever the architects or product owners come up with an idea never seen before I prototype using Mithril, because all other tend to fail involving of unexpected amount of complexity. Mithril gives you all degrees of freedom and surprisingly often that's considered a disadvantage.<p>Did I mention it's fast?
I’d like to use a simple front end library that doesn’t use a vdom, doesn’t require a special state system, doesn’t require special compilation, is performant, and largely gets out of my way.<p>I currently use Preact and am pretty happy with it, even though it doesn’t check most of those boxes. Is there something that does?<p>Anyway, Mithril looks nice. I’ve kicked the tires a few times, but comments like the ones here in this thread have prevented me from adopting it.
From the Framework comparison page: "Guild Wars 2 uses Mithril (yes, inside the game!)"<p>I would love to hear more about that! Anyone know where I can find more information?