Re:Riot – A React-like, 2.5K user interface library
by sanityinc on Friday January 23, 2015 @03:28AM
(#8933916)
Mithril is a tremendous little framework, and Leo has done an exemplary job of writing it, documenting it and blogging about usage patterns and tricks. While declining frequent requests that he cram more functionality into its core, he takes the time to explain the trade-offs, showing a deep understanding of the problem space which gives me confidence to build upon his work. So thanks Leo!
Hopefully, in time, more people will realise the "zen" of mithril's minimal approach. In the meantime, interested readers can check out lichess.org, which recently rewrote its impressive UI using mithril.
Re:Riot – A React-like, 2.5K user interface library
by dopamean on Friday January 23, 2015 @06:40AM
(#8934374)
I work at a coding bootcamp and we recently used Mithril to teach one of our JS units. I was skeptical at first that it would be properly understood by novice developers... boy was I wrong.
Mithril is an awesome framework. A breath of fresh air really.
Re:Riot – A React-like, 2.5K user interface library
by tipiirai on Friday January 23, 2015 @05:47AM
(#8934226)
Mithril "HTML" syntax is not for my taste:
return m("html", [
m("body", [
m("input"),
m("button", "Add"),
m("table", [
m("tr", [
m("td", [
m("input[type=checkbox]")
]),
m("td", "task description"),
])
])
])
]);
Re:Riot – A React-like, 2.5K user interface library
by insin on Friday January 23, 2015 @07:18AM
(#8934483)
I did a quick tweak of React's JSX transpiler to output mithril-compatible code [1], as the above was the sort of syntax I was using JSX to get away from!
return <html>
<body>
<input>
<button>Add</button>
<table>
<tbody>
<tr>
<td><input type="checkbox"/></td>
<td>task description</td>
</tr>
</tbody>
</table>
</body>
</html>
[1] https://github.com/insin/msx/
Re:Riot – A React-like, 2.5K user interface library
by tipiirai on Friday January 23, 2015 @08:31AM
(#8934701)
Definitely more readable than Mithril
Re:Riot – A React-like, 2.5K user interface library
by rapind on Friday January 23, 2015 @11:02PM
(#8938771)
I think it starts to look like HAML / Slim / Jade once you use CoffeeScript. Understandably not for everyone, but I quite like it, and it doesn't mess with your syntax highlighting like JSX does.
m "body",
m "input"
m "button", "Add"
m "table",
m "tr",
m "td",
m "input[type=checkbox]"
m "td", "task description"
Re:Riot – A React-like, 2.5K user interface library
by dopamean on Friday January 23, 2015 @06:41AM
(#8934376)
Agreed, it's not the best. Maybe you can help come up with something more palatable?
Re:Riot – A React-like, 2.5K user interface library
by istoica on Friday January 23, 2015 @10:15AM
(#8935200)
yes man, this abstraction is horror, I hope mithril adheres to something else for declarative tasks a the one above
Re:Riot – A React-like, 2.5K user interface library
by easymovet on Thursday January 22, 2015 @02:22PM
(#8931132)
Where does Mithril fit in this stack: RequireJs, Knockout (with components), SammyJS (for routing/browser history and events)?
--After doing some reading it looks like it replaces some of knockout and sammy but I'd lose data binding and dependency tracking of knockout.
Re:Riot – A React-like, 2.5K user interface library
by lhorie on Thursday January 22, 2015 @03:05PM
(#8931397)
Mithril is roughly equal in scope to Knockout+Sammy. The small gap between what most frameworks call "bidirectional data binding" and what it actually is in terms of vanilla js can be bridged with simple functions (I talk about that in a slightly more advanced context here: http://lhorie.github.io/mithril-blog/asymmetrical-data-bindi... ).
Dependency tracking can refer to two things: tracking changes for the purpose of updating the DOM (which Mithril does handle, albeit in a different way), or computed properties (which I personally think are not a good idea, but that you could do w/ an observable library from microjs)
On a related topic, I talk about complexity walls (the idea of code that outgrows a framework's zone of comfort) here ( http://lhorie.github.io/mithril-blog/decreasing-cognitive-lo... ) and there are slides for a presentation I gave a while back that talks about the design decisions that went into Mithril to reduce learning curves. (here: http://lhorie.github.io/mithril-presentation-oct-js-tech-nig... )