
Why I'm coding with Mithril - pelonpelon
I have experience creating a very complex React app to organize a conference. It included registration, authentication, personalized schedules and calendars, news articles, up-to-the-minute updates, a store, physical pass(ID) verification, and a few dashboards for use by clients of my client. Honestly, it was a lovely experience.<p>Presently, 58% of users of my current client&#x27;s site arrive via mobile and minified React tops 145kb, which takes a lot of time to deliver and unpack. I serve 1000 new users per week who can&#x27;t rely on finding React in their browser cache. This is too much overhead. I am a little obsessed with under-one-second loading and 3 second attention spans. Non-minified React is 642kb and that&#x27;s too much code for me to grok if I want to understand what my application is doing.<p>Then I found Mithril. It&#x27;s faster than anything. It&#x27;s tiny. It does only what it needs to do, no bloat. And it does most of the good stuff that React does. It&#x27;s also FRP friendly, another current obsession of mine.<p>It&#x27;s in the early stages, but it is so small and focused that it can be used anywhere. TODAY. mithril.js is small enough to understand in detail. Beyond the basic documentation is a blog and API docs written as precisely and as focused as the code. It&#x27;s a testament to its quality that the earliest blog entries are applicable today. I recommend reading them from oldest to newest. They read more like a tutorial than a blog. Post a question to the Google Group and Leo will likely refer you back to a blog post because he&#x27;s already covered your question.<p>Another sign that Mithril is of great quality: most public discussion about Mithril revolves around the philosophy and logic of app design, not code errors. When errors are discovered, Leo patches them within hours if not minutes.<p>Leo got so much right. Most things right. More than any other framework I know.
======
jf22

      todo.view = function() {
        return m("html", [
            m("body", [
                m("input"),
                m("button", "Add"),
                m("table", [
                    m("tr", [
                        m("td", [
                            m("input[type=checkbox]")
                        ]),
                        m("td", "task description"),
                    ])
                ])
            ])
        ]);
      };
    

That's some sample view code right?

The heck is that?

With IDE support being so good why would I ever subject myself to using non-
html view code anymore? There is no way I want to do a complex site in that
kind of syntax, that's just crazy.

~~~
lhorie
Hi, Mithril author here.

> With IDE support being so good why would I ever subject myself to using non-
> html view code anymore

As others have mentioned, preference for angled brackets can be solved with
tooling. insin's MSX exists precisely to address this very concern, and it's
dead simple to setup. As you might have noticed, Mithril's syntax is designed
to look like the _other_ language of the web: CSS. In practical terms, what
this meant to me was to replace the usage of Emmett CSS-to-HTML expansion
macro shortcuts in my text editor w/ a macro shortcut that spits out `m("")`
instead. Coupled with simple IDE features like automatic bracket matching, I
think you can get a typing experience that is very close to what is familiar
to users of productivity tools like Jade/Haml/etc users (and with no
preprocessor step required).

The actual reasons for templates to be pure js are slightly more technical: it
gives better error reporting, proper scope/closure/variable shadowing rules,
turing completeness (for the purposes of refactoring/abstraction, etc), it's
friendlier to transpiled language users, it's lintable, it's compressable,
it's statically analizable, etc.

Also, in my experience, complex apps tend to get heavier on logic than actual
markup (this was actually the first thing my previous boss noticed when I gave
him a simple code example when I was showing him the framework)

