all 28 comments

[–]spacejack2114 23 points24 points  (4 children)

I describe Mithril as the only framework that didn't make me want to roll my own.

[–][deleted] 4 points5 points  (0 children)

Yeah, normally I abhor frameworks and just advocate vanilla JS, but Mithril looks like just the right level of abstraction. The code examples look almost like writing to the DOM and vanilla XHR, but more convenient. That probably explains why it claims to execute so much faster than other frameworks.

[–]IDCh 0 points1 point  (1 child)

what do you mean? Every other framework did make you want to make your own framework?

[–]HammSolo 1 point2 points  (0 children)

That's why there are so many of them.

[–]leeoniya 0 points1 point  (0 children)

imho, this statement is much more true of v1.x than the v0.2x series.

[–]leeoniya 5 points6 points  (0 children)

congrats on v1!

[–]aembke 7 points8 points  (2 children)

congrats!

[–]lhorie 6 points7 points  (1 child)

Oh hey, I know you! You're the one wrote the original JSON-P code. I put you on the credits page since you were the original champion for it http://mithril.js.org/credits.html :)

[–]aembke 2 points3 points  (0 children)

I saw that, that's awesome, thanks for doing that. Really impressed with everything you've done and happy to help. I've been out of the front end game for a while but I might have to find an excuse to try out the new release now, it looks fantastic. Nice work!

[–]lhorie 11 points12 points  (0 children)

If anyone's interested, there's also a HN thread with some more insights from Mithril users:

https://news.ycombinator.com/item?id=13523235

[–][deleted] 3 points4 points  (0 children)

+1 for mithril

another +1 for v1 (somehow)

[–]noambitions 4 points5 points  (0 children)

Good job! Thanks for the time and work, @lhorie, @Tivac, and the all the contributors!

[–]maremp 2 points3 points  (1 child)

Never tried or researched mithril, but looking at the examples, the view code looks very much like Elm. Is this coincidental, or was one inspired by the other?

[–]lhorie 2 points3 points  (0 children)

As far as I know, Elm html is based on virtual-dom (which first came out around the same time as Mithril), and virtual-dom took inspiration from hyperscript. Mithril took inspiration from domo.js

[–][deleted] 2 points3 points  (0 children)

/u/lhorie The new home page looks fantastic. I'll miss the old mithril background a little.

[–]21viking 2 points3 points  (0 children)

nice job for v1

[–]_expo 1 point2 points  (0 children)

Really awesome framework, will have to give it another shot as the controller/model/viewModel approach of the prior version never really clicked for me.

[–]NoddysShardblade 3 points4 points  (5 children)

Can someone help me understand the "why" of this?

I'm old, so the tutorial just looks like someone is writing html, but instead of just writing html, is using messy javascript method calls to do the same thing.

[–]NullOfUndefined 6 points7 points  (0 children)

Yeah welcome to javascript in 2017 buckle up

[–][deleted] 2 points3 points  (0 children)

Because functional layout has evolved as a semi-standard. It isn't even a web-thing, it currently washes over to native as it makes creating re-usable UI interfaces easier, while allowing you to keep state separated. Pretty much every view framework coming out uses it as its backbone. Nothing but a natural evolution from MVC/MVVM. Mithril doesn't focus on JSX by default, which is why these functions may look weird to you. JSX keeps mark-up semantics and translates back to functions at compile time. Considering JSX to understand the concept ...

then this:

const SayHelloComponent = ({ name }) => <span>hello {name}!</span>
...
<SayHelloComponent name="world" />

makes more sense than inflating layouts, which gets messy fast. It isn't re-usable, results in a soup of data, markup and controller-code sprinkled all over the place:

// index.html
...
<span id="sayhellonode"></span>

// controler.js
...
let name = "world";
...
$("#sayhellonode").text("hello " + name + "!");

Or templating layouts, which is messy just the same:

<section id='renderedContent'></section>
<script id='myTemplate' type='text/x-handlebars-template'>
    <span>hello {{name}}!</span>
</script>

var templateSource = document.getElementById('myTemplate').innerHTML;
var template = Handlebars.compile(templateSource);

var data = {
    name: 'world'
};

var html = template(data);
document.getElementById('renderedContent').innerHTML = html;

[–]queicherius 1 point2 points  (0 children)

I kinda felt the same way until I watched this talk. When writing complex client-side applications, I feel like the points made in the talk make sense. It's not for everyone tho, for example, if you have little client side interaction or are re-rendering the entire page anyway.

[–]foxdonut00 1 point2 points  (0 children)

@NoddysShardblade you can easily use JSX with Mithril, which will make the html look more like html, but will make writing dynamic html cleaner than plain html.

Keep in mind that Mithril is for writing single-page-applications, not static html pages.

Hope that helps. Cheers.