What are the advantages and disadvantages of Angular.js vs. Elm?

后端 未结 3 1486
太阳男子
太阳男子 2021-01-30 16:24

I\'m looking into doing some reactive programming in the browser and comparing angular.js (http://angularjs.org/) with Elm (http://elm-lang.org/).

What are the relative

3条回答
  •  生来不讨喜
    2021-01-30 17:06

    Elm is a lot more opinionated than Angular, and notably with respect to state management. If you find state becoming an issue in a conventional Angular app, then you might be tempted to look towards centralised (monolithic state) using a Redux style approach, with ngrx coming quickly to mind.

    Elm epitomises the notion of a central immutable state, and was an inspiration for Redux. Elm enforces a single immutable state with a pure update (reducer) function. In my view that makes handling state in a highly reactive web app much, much simpler than the confusion that can arise using an OO-like pattern in Angular.

    Elm is great for most apps, but its can become a little more complex when you want to work with external JS libraries (e.g. google maps), as its foreign function interface (ports) is quite rigid. The sort of animations needed in Material Design has also proved challenging for the Elm Architecture - that's not to say that there aren't animations, but that they take more wiring up than you might want to do.

提交回复
热议问题