admin管理员组文章数量:1279175
How easy is it to use ready-made jQuery plugins in Elm? I'm just starting to learn Elm lang and I'm curious if it's possible to use Semantic UI's dropdowns in my application. How should one approach such task? Without libraries like Semantic UI it's pretty hard to make proper dropdowns for mobile, for example, and writing all that code from scratch seems like reinventing the wheel.
How easy is it to use ready-made jQuery plugins in Elm? I'm just starting to learn Elm lang and I'm curious if it's possible to use Semantic UI's dropdowns in my application. How should one approach such task? Without libraries like Semantic UI it's pretty hard to make proper dropdowns for mobile, for example, and writing all that code from scratch seems like reinventing the wheel.
Share Improve this question edited May 24, 2016 at 11:53 therealmarv 3,7424 gold badges25 silver badges42 bronze badges asked Aug 11, 2015 at 13:08 Victor MarchukVictor Marchuk 13.9k12 gold badges45 silver badges67 bronze badges 4- I think what you need is ports – Mirzhan Irkegulov Commented Aug 11, 2015 at 14:30
-
Could you elaborate? Do I create a port for each dropdown and update it whenever a corresponding part of the state has been changed in
update
function? Sounds like a ton of boilerplate. – Victor Marchuk Commented Aug 11, 2015 at 19:33 - I have this issue as well, having a site already in semantic-ui. – alesch Commented Aug 24, 2015 at 11:36
- 1 Not Semantic UI related but a working Bootstrap Dropdown You can also use most of CSS only party of Bootstrap with Elm (which is a lot). – therealmarv Commented May 26, 2016 at 14:20
2 Answers
Reset to default 8It's not a good idea. Elm is pure. That means for any given state, we can generate the UI. And to programatically change the UI, the state must change.
The entire reason for using Elm is because of the belief that impurity is difficult to reason about, and purity is preferred.
jQuery makes it possible for an action to directly read & modify the UI without changing the application state. It's impure.
Thus Elm and jQuery are fundamentally at odds and you will likely get into a mess trying to get the two to work together.
Probably the easiest way to proceed is find a CSS library that doesn't require JS, that gives you a reasonable set of ponents to work with (e.g. http://purecss.io/) and use Elm in conjunction with that.
I don't know about jQuery specifically, but Elm has a Ports / Interop System specifically for using existing Javascript libraries and avoiding re-inventing too many wheels. I haven't use it but it might fit your needs.
本文标签: javascriptWire up Elm lang and Semantic UIStack Overflow
版权声明:本文标题:javascript - Wire up Elm lang and Semantic UI - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741285732a2370257.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论