dojap
Which JavaScript framework do you prefer to use with Phoenix?
When you have to use one, which do you prefer and why?
React or Vue, or something else?
Most Liked
dorgan
I’ve used pretty much all of them, though not for too large projects. My personal conclusion is that, unless you have some specific product that requires a feature that only one of these offer, then it doesn’t really matter.
For the most part, except maybe for Angular(and maybe Ember?) they’re view libraries, so they’re just a templating system and some reactivity system to trigger view updates when data changes.
React and Vue have large ecosystems. Vue has always been a bit lighter(if we count react + react_dom) than react, but really it’s not that important. I’ve fiddled with React and Vue 2, I built a somewhat big Vue SPA, there’s nothing particularly weird about them(except the react hooks rules). Vuex was a pain in the ass, because at the time I didn’t really understand the problem it solved and everybody was hyping redux like stores. Lesson learned there. They both performed very badly in my low end phone. I’m not 100% sure if it was because of the framework or because of my mistakes, but switching to custom elements and doing stuff myself solved it for the most part.
Svelte has a compiler to “optimize” the code and “reduce bundle size” and “gain speed”. The truth is that not using a Virtual DOM approach is not a benefit per se, libraries like Inferno use VDOM and perform better in a lot of cases. Bundle size is amortized for small projects, but if you have lots of components then the promise of “vanishing js framework” starts to break. It’s fast and excellent, but not the fastest. Still for a lot of use cases I’m unsure if this is a useful benchmark.
Solid is another library that recently reached v1.0, it’s compiled as Svelte, but faster, and Ryan(the author) is a very nice person. The api is very similar to react hooks, but the reactive system is far better. If you know the Meiosis pattern or RxJS, it has similar ideas. If I were to use one today, I would probably pick Solid, because of Ryan and because it uses similar ideas to the ones I’ve been playing with in the past.
Marko is a framework by the Ebay people, it’s able to do SSR, streaming and a lot of the stuff React now presents as shiny new but since 2014. I’m very interested in it but didn’t have the chance to use it.
Then you have the Browser, you can use the Custom Elements API and write components that render using something like Lit or uhtml, but this is more of a DIY approach. I love this approach, but I understand some people just want to use a full blown framework.
I’d love to give a recommendation but after using a lot of them I realised that the complexity comes from building UIs, not so much from the frameworks themselves. People have built awesome stuff with all of them.
code-shoily
I very roughly explained the process here: ClojureScript + LiveView - Backend Chat/Discussions - Devtalk but once I get to work more on this and address some rough edges, I will write a better looking post about it.
tl;dr
A PR that documents the process - Move to clojurescript by code-shoily · Pull Request #2 · code-shoily/miles_to_go · GitHub
A repository with LiveView hooks with ClojureScript (widgets: Line Charts, Pie Charts and Heatmap via PlotlyJS) - GitHub - code-shoily/covid19: A Phoenix app to display Novel Coronavirus (COVID-19)
superchris
Thanks for the shout out
We’ve used LiveView and Web Components together now on several projects and it’s worked out very well. In my humble opinion, it’s a perfect fit. Live View is great at managing DOM Elements, and since Custom Elements are still just DOM Elements at the end of the day, it makes a nice boundary to add in javascript when it is the best solution to a specific problem.







