Open jussiarpalahti opened 8 years ago
Hi @jussiarpalahti,
On mithril's website, it says 1.0.1. http://mithril.js.org/
Another thing, could you comment on the difference between this project and https://github.com/owengalenjones/moria ?
I've used mithril extensively and I would like to give it a spin in ClojureScript. It would be nice if you could outline some caveats about the combination.
Thank you very much,
Hi, @veggiemonk, thank you for your interest.
Just about the same time Mithril went 1.0 ClojureScript gained support for NPM modules. This should make it much more easier to use libraries like Mithril which haven't been as popular as, say, React in Cljs world. However, I've yet to find time to properly learn how to use newest Cljs. Mathom's boot built config broke by the upgrade to newest Cljs and I have to figure out what configuration works this time around...
I took a cursory look at Moria's code. It seems it's has more, perhaps complete support for Mithril 0.2 API than I did. I mostly just supported what I myself used in Mithril, which means m function for HTML, routing and XHR/Ajax. I have made a couple of apps which have state management and time travel (of sorts). You can use all of Mithril 0.2 API in Mathom too, but it can be more work because JS interop syntax makes for a lot of boilerplate...
As per your other question, I don't quite get what you mean. What combination are you referring to?
I created issue on Moria's repo to ask about upgrading to 1.0: https://github.com/owengalenjones/moria/issues/1
Hi @jussiarpalahti,
Thank you for taking the time to answer.
The combination I was referring to is ClojureScript + Mithril.js. I did not know Cljs gained support for NPM modules. I went to see http://cljsjs.github.io/ for mithril.js but it has only 2 stars out of 5. It's not very popular so I was wondering what are the best options to use mithril in Cljs.
Great idea to post on moria! I hope he will reply. I follow the issue.
Thanks again
Ah, OK then. I try to elaborate abit, @veggiemonk
Cljs folks have often lauded React and it's chosen by Om, Reagent and many other libraries. In my mind Mithril does what React does but with much smaller API surface and essential features that React doesn't offer like routing and XHR. State management in Mithril is, like with React, left to developer to implement. For this I wrote simplest thing I could think of after reading about Om and Reframe and it worked very well. Cljs has many tools that JS folks need to load as libraries which bring their own complexity. Thus Cljs + Mithril is light yet powerful combination.
On the other hand, Cljs has still very bothersome interop with JS. Whilst NPM support have recently arrived, even that don't seem as plug-and-play as JS side has with Webpack and stuff. So, you either implement things from scratch in Cljs or wrestle JS libraries to Cljs side. It's this hardship that has prevented me from embracing Cljs (and that we use JS at work so...). There's just so much more stuff on JS to deal with complex things like web APIs and whatnot for.
I keep trying again every now and then, though. :)
This issue is just to make a note of Mithril's 1.0 rewrite and my forthcoming attempt to move Mathom to it.