This is covered by point 4) in the list. What I tend to do is to render a component inside a normal Phoenix template (e. g. <div id="componentRoot"></div>
) where I then render a JavaScript application that can also call API endpoints or react to websocket messages if it must.
But I keep the navigational logic in Elixir and Phoenix. That way I can leverage established standards for authentication and authorization - and this is a huge win. (But this is a pet peeve of mine, so please take it with a grain of salt
)
But I assume that you have something specific in mind. Could you extend on that?
No. Elm is in my opinion the best choice for frontend/SPA development by a long shot. That is not to say it is perfect. In fact far from it. But is still the best option for beginners and seasoned programmers. In fact that says a lot more about the competition then about Elm, but I stand by that.
I have (professionally) developed and / or supervised projects in Angular (1/2/…), React(Native), Ember, Vue, Hyperapp, Elm, jQuery(-UI) and Reagent (ClojureScript) and with the exception of Reagent and Elm all of those suffer from long term […] rot in my experience.
(I just deleted five paragraphs… ranting is not too productive
)
There are three cases where I’d advise against using Elm (after having decided that you need a frontend framework):
- When you need to be able to show off proficiency in JavaScript or a specific framework.
- When you hate beeing bossed around by your tools (or doing things thoroughly)
- When you need to use specific, ready made things that do not integrate with Elm. In which case point 1) from my algorithm takes effect.
Acutually I cannot. There are so few resources because there is not much to it. You can use the package you’ve found which looks quite good but actually there is no magic in it:
- Using a Phoenix REST/GraphQL-API is simply using those APIs
- Using sockets is not more than using the standard Phoenix socket client, setting up an Elm port and sending messages over this port whenever they arrive
That’s it.
That beeing said: this is my experience with all these technologies. In the end whatever you choose needs to be what you’re comfortable with.
(Reflecting a bit: ClojureScript with shadow-cljs might be a worthy contender to Elm in certain situations, but oh boy is that not beginner friendly
)