Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Mithril's use of helper assisted javascript for it's view templating is a giant drawback for me. I'd be using it exclusively, but as an old crusty dev, I've gone down that path more than once, and it's always been a train wreck.


You mean how the DOM is constructed via JS functions? There's this project to fix it: https://github.com/insin/msx


Thanks for this, I was looking for something that could keep me using Mithril.


FYI, you can use Babel to transpile JSX for Mithril by putting this in .babelrc:

    {
      "jsxPragma": "m"
    }


I thought this at first too -- the syntax turned me off. But having it used it for a while now, I can say any drawbacks are purely cosmetic, and it's easy to get used to. If that's the only thing holding you back, I'd say to give it a try.


What do you mean by "helper assisted javascript"? Can you give an example where this has caused problems for you? I'm trying to decide between mithril and this library.


Sorry, poor word usage on my part. As vvpan more eloquently puts it, DOM construction via js functions. This is the example from their website. This is very difficult to maintain, and personally, I become very adverse to making changes. Though it appears vvpan has a link to a project attempting to fork(?) React's transformer to be usable in mithril.

    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"),
                    ])
                ])
            ])
        ]);
    };


Not "attempting to fork", MSX is a JSX fork that outputs Mithril-compatible virtual DOM JS objects.

It works as advertised :-)


Since I've been called out twice on my use of language in this thread alone, I serious need an editor to proof my comments before I submit them from now on.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: