Hacker News
6 days ago by fishtoaster

As someone who lived through all major waves of JS for the last ~16 years, I do love react, in a sense:

React is the worst JS framework except for all the others we've tried.

I'd take React over the Angular 1 days any time. I'd take Angular 1's full-bodied MVC over the "build it yourself from scratch every time" approach of Backbone. I'd take Backbone's minimal MVC structure over the classic JQuery Soup architecture. And I'd take JQuery's dom manipulations and standard-library improvements over the native apis (of that era) in an instant.

React has its tradeoffs, but we got here after a long slog of other things that don't work.

6 days ago by digitaltrees

But why over vue? My biggest frustration has been how vue ends up moving in the direction of react. The original component architecture with the html template, JavaScript state and css styles in vue was so nice. Even the data fetching a url in the component was so intuitive.

6 days ago by robocat

A bit out of date, but I like the point-of-view of "The single most important factor that differentiates front-end frameworks" : https://mjswensen.com/blog/the-single-most-important-factor-...

6 days ago by Lammy

> A bit out of date

> article just about to turn three years old

JavaScript community never beating the allegations lol

6 days ago by ahartmetz

Fantastic article. It is strange that such important aspects of JS frameworks are so rarely discussed.

6 days ago by jemmyw

Great article. I prefer the react model over the other models. Now it'd be good to know, with every framework, which of these it implements.

6 days ago by rao-v

Terrific read thanks for digging it up

6 days ago by patates

I was deep in Vue 5-6 years ago, so much that I offered internal training for it and had sessions with more than 20 people attending.

IMHO, React wins because you can just treat templates as variables. You don't need "slots" or other special stuff. It's simply more composable.

6 days ago by hajile

Vue doesn't solve problems better than React (and solves them worse if you have to learn all their proprietary files and DSLs instead of JSX), so there's not much of a reason to switch.

The real discussion would be between React's vdom and something like Solid's signals.

6 days ago by lwansbrough

It does, if you care about ergonomics. The reactivity model is simpler and arguably less error prone.

It does have its own templating syntax, which is trivial to learn. No more cumbersome to learn than JSX, which is a templating language designed by the React team. Not sure why you chose to make the distinction between JSX and Vue’s DSL as if JSX wasn’t developed for the sole purpose of facilitating React’s virtual DOM.

6 days ago by mmis1000

Vue solve single source of truth much better than react though. The shape of derived data and source data (or even external data) are the same and interchangeable. So you can write an api that works with both without handling implementation quirks at all.

The words borrowed from someone else:

The react is more about view.

The vue is more about reactivity

6 days ago by lthi747

So JSX is not proprietary?

6 days ago by onion2k

The company I work for uses Vue. I think the non-backwards-compatible move from Vue 2 to Vue 3 burned a lot of the current devs, so now they're stuck working on Vue 2 apps that are in maintenance mode with no viable case to clean up the mess by moving everything to Vue 3. The experiments to do it with Copilot mostly failed, although that was in the early days so another try today might work better. If we're doing something drastic to improve though, we might as well solve our "Vue devs are hard to find" problem by rebuilding it all in React at the same time.

6 days ago by Ronsenshi

I am in a process of upgrading fairly big Vue 2 app (technically 2 apps, where one is not traditional and the other uses Inertia) to Vue 3.

It is a fairly painful process - I am using Codex and Claude as a first pass for converting things, but everything has to be checked manually and often fixed or rolled back to try again. Too often instead of "removing" piece of code that is not necessary anymore, AI would try to add a 100 line workaround for it because it would really rather add things than remove them.

It is, however still a faster process than doing manual rewrite. Smaller components are a breeze to convert from older Vue 2 to Vue 3 composition API.

Rewriting entry point app.ts with bunch of custom plugins was a horrendous experience that eventually was done manually. Move from Vuex to Pinia was also 50/50. Some things were easy, some things were not and had to be done manually.

Then there's a process of switching from unsupported packages which is a whole other can of worms.

Overall - if not for AI I'm not sure I'd have gone with an upgrade at this point. Yes it requires careful review and testing, but a ton of trivial stuff was done very quickly.

6 days ago by gbuk2013

I led a project to (successfully) migrate a Vue 2 to 3 app and while that was painful and expensive, I still find Vue more pleasant to work with than React once it was done. But TBH depending one team code discipline either could be fine or a nightmare. :)

6 days ago by beering

Agreed. Like you, I went from hand-written cgi-bin html to jquery to angular v1 to React. I will willingly reach for React as a tool - it does what I want to do.

6 days ago by stevepotter

I remember in 1999 being so psyched about changing a button image on mouseover. Went hard on jquery, little bit of angular and bootstrap. React was big for me because it’s one way data binding solved the kinds of bugs I had spent years dealing with. Vue svelte and others are cool but they are all very similar to me. I always encourage people to work at first without any framework because then you gain an appreciation for why these things exist (or you stay vanilla and constantly blog about it)

6 days ago by ricardonunez

I like react over angular and vue over react.

6 days ago by synergy20

same here thus I'm with vue

6 days ago by victorbjorklund

Have you used Svelte? I can’t see why anyone would like React more. The only upside I think react has it’s the IBM of frontend. No one has been fired for choosing React.

6 days ago by theflyinghorse

Currently rewriting nextjs app into sveltekit. It’s going surprisingly smoothly. Don’t know about svelte vs react yet BUT sveltekit is far more straightforward than nextjs has far better DX and is somehow faster

6 days ago by stevepotter

Svelte is cool although I didn't have some big epiphany. I'm not going to use Svelte because "it compiles" and "is faster" when my existing React app performs very well. Plus there are some libraries for my specific use case that didn't exist in Svelte. I know people love things besides React, and I would be happy to see it unseated. Sure I'm part of the problem but it's been good to me and I have bigger fish to fry.

6 days ago by bryanhogan

> Plus there are some libraries for my specific use case that didn't exist in Svelte.

A lot of these libraries aren't needed in Svelte because 1) the functionality might already be built into Svelte, and 2) you can use any JavaScript library directly, unlike in React where you often need a React-specific wrapper.

Not saying that applies to your specific use case, but I've seen this argument way too many times.

6 days ago by brikym

Just use JS libraries. You don't need wrappers.

6 days ago by satvikpendem

More library support for React over any other framework. I also like explicit state change over implicit.

6 days ago by pibaker

Of course people do. No one is forced to use React or any other web framework unlike how they are practically forced to use JavaScript, and yet React wins. This should be enough evidence that people like it enough, at least more than most other frameworks out there.

It is also somewhat ironic that until late 2010s a common complaint about web development is how fast it changes and how many new things are coming up all the times. It was a very valid complaint, of course. But then when the React monoculture rose to the top, and everyone decides to complain about how that sucks instead. You really can't win.

6 days ago by r0m4n0

I have never been able to pick the framework and libraries for my day job. I’m almost always working on something someone started years prior or bound to an organization that has strict choices. Personally I wouldn’t pick react :)

React wins because it has become a default choice and folks like what’s comfortable to their preferences

6 days ago by pibaker

I mean, that means someone at your work liked React enough to choose it over the alternatives.

I see a lot of personal projects, solo founder applications etc running made in React. I respect your opinion but other people definitely do choose it when they have fully control of what they use.

6 days ago by wesselbindt

I've been in the situation a couple of times where we had full control over choosing the frontend framework. Every time we chose React, the main argument was hirability and the fact that the engineers in question were most proficient in React. That is, inertia.

Secondly, when someone new asks me what web framework to learn, I tell them React. And the main reason, every time, is that this is more likely to get them a job, i.e., inertia.

We got here somehow. Clearly, React didn't get here purely on momentum, and must have done something less poorly than the other frameworks. But I think it's hard to deny that inertia plays a big role in its current popularity.

6 days ago by janalsncm

That doesn’t mean they like it now, and more importantly it doesn’t mean it was actually the best choice at the time.

I used to be on a team that used Mongo for a relational database because Mongo was trendy at one time. So all joins had to be done in the application layer.

5 days ago by r0m4n0

Hey careful, I actually didn't say I do or have worked with React :)

I think you get me now but I'm just merely stating the stickiness and trendiness of these architecture decisions. Some other people mention this but just because a majority of the industry works on something doesn't mean it is the best.

I am a bit of the proof of this. I work on Angular at Google and have for a long time. It is kind of comical because I have worked on a few side projects outside of Google and I always use Angular, I know it too well.

I built a massive Angular webapp recently (2025) outside of Google and have had multiple people approach me about migrating it to React. They come at me like this is some old thing that needs to be refactored to unlock the modern times. It's just curious, there are large groups of people that don't really even understand what they are doing, they are just chasing words and hype. Mind you, there are reasons to pick one framework over the other still... but let's at least debate that instead of just the names of frameworks. React has won the framework adoption race so I can't argue much there.

6 days ago by TonyStr

Most decision-makers make decisions based on what they already know. Most of my colleagues only know React, because they've only been exposed to React. Why do you think Java dominates the market still? React solved a huge problem when it was new, and it still solves that problem fine (change detection - the reactivity model). There are better alternatives available now (Vue - signals), but the difference isn't big enough to create a new monoculture. Sure there are peripheral concerns like how mature the ecosystem is or the particular ergonomics of a framework, but these are mostly fluff.

6 days ago by curtisblaine

React wins because it has a predictable interface that has become industry standard. Industry standard saves money. Not everything must be creative.

6 days ago by owebmaster

React is bad exactly because this predictability doesn't exist, it changed radically for the worse at least 2 times without any consultation to the community

6 days ago by pjmlp

Not very predicatble with Vercel ownership.

6 days ago by Cakez0r

React does have its benefits, but there is also a tendency to pick it because of the inertia it has over whether it is the best tool for the job. "Everyone uses react and this will maximize our hiring pool / set of contractors we can use", "A react project will look good on my resume".

6 days ago by pibaker

I don't see why "inertia" or adoption should be excluded when deciding what library to use for the job. If you are manufacturing a physical product you will need to consider how easy it is to source any component before adding it to your bill of materials. I don't see why software engineering should be different. There is a reason why we are all working in boring languages and not Haskell or LISP despite their supposed technical superiority.

6 days ago by gentleman11

What do you mean nobody is forced to use react? What is this brave new world where you can learn lisp and use it for everything you desire, where corporate culture has no sway over your tech choices?

6 days ago by pjmlp

On the contrary, I am forced to use React and Next.js as many SaaS vendors have partnerships with Vercel, and only make extension points available with them.

If I want anything else, I have to implement the integrations myself, search for some open source project that has already done it, or ask AI.

Doable on hobby projects, unthinkable in professional settings.

6 days ago by moojacob

I like React. And I have seriously tried the HTMX/Hotwire camp.

I wanted to make a back button use browser APIs to go back if the coming from the inbox, just link to the inbox otherwise to preserve scrolling. I had to wire the actions from the html to call the function that goes back, then in my controller determine the previous page and send the JS enabled back button or the hard link. My logic was spread out over 3 files!

With React I can have js in a component determine if the previous page was inbox, and based on that value show the back button JSX or the link. ALL IN ONE FILE. One conceptually entity for me to model vs 3 that do other things and this functionally is hammered in.

Is it slower? Definitely. But it makes me happy. Miserable in a corporate React slopbase? Blame your coworkers, it would definitely be worse without it.

6 days ago by petcat

> I wanted to make a back button use browser APIs to go back if the coming from the inbox, just link to the inbox otherwise to preserve scrolling. I had to wire the actions from the html to call the function that goes back, then in my controller determine the previous page and send the JS enabled back button or the hard link.

This is why I hate react spas. They're always trying to find some stupid way to break my browsers back button and navigation buttons.

I will always prefer htmx/server rendering with native everything (except the occasional form boosting.)

6 days ago by kcrwfrd_

They are actually speaking to trying to make an in-app back button use the history stack so that it _doesn’t_ “break” your browser’s back button.

The problem with just calling history.back() with no fallback is it will bounce users out of your app (back to Google or wherever they came from) and PMs won’t like that…

6 days ago by zarzavat

`history.back()` shouldn't even exist, it's almost never correct to use it instead of a logical back button that works on the logical navigation structure e.g. going up a level, or to the previous page, etc.

For example, if you are on Page 5, then pressing "back" inside the app should always take you to Page 4. `history.back()` could take you to any page, it's unpredictable.

6 days ago by jeroenhd

That's not a react thing, it happened before React was even a thing. It's just self-centered website programmer design.

6 days ago by imperio59

This has been a non issue when using proper routing libraries that push history entries on the stack properly and render routes from the top of the component tree down.

You hate BAD react SPAs that break the fundamentals of how the web works. Good ones take care to not do that.

React fundamentally doesn't cause this issue either. You can use a different framework than react or even vanilla JS and still produce the same bugs.

6 days ago by Zanfa

> You hate BAD react SPAs that break the fundamentals of how the web works.

But that’s all of them? If Github, Reddit, LinkedIn and Facebook and others are unable to build SPAs that don’t constantly break the fundamentals while also choking the browser, maybe it is a tech problem.

6 days ago by 3eb7988a1663

Sure, but the internet is majority bad SPAs vs good ones. Rarely am I delighted by a SPA, but suffer through how poorly it works in bad network conditions, usable back buttons, or otherwise respecting the user.

6 days ago by anon7000

It’s an absolutely not true that react is especially bad for this behavior.

I think that lots of more traditional websites have very poor back button designs, especially around editing and form submissions. Remember clicking back and the browser prompting for form resubmission? Very poor design since you have no clue how the server will even handle form submissions. Or getting stuck deep in an application, hard to get back to the root. Or, consider encoding current page data that you’re editing into the URL, and back buttons don’t return to root and just strip query params. Often a very frustrating experience.

Often, “go back to what I was doing before” is what I actually want, not “go strictly to the previous state in the URL bar.”

Sure, plenty of people mess that up too, but the reality is that controlling the navigation stack can help you build more useful designs.

6 days ago by evolve-maz

My advice would be to only use HTMX for data state related operations. For something like an intelligent back button, unless it depends on resource state do not use the backend to calculate it.

The recommended htmx way would be to hook up an onclick button to inline js or if you dislike that, a function called goBackOrInbox. It can then be something like:

function goBackOrInbox() { if (document.referrer) { const path = new URL(document.referrer).pathname; if (path.startsWith('/inbox')) { history.back(); return; } } window.location.href = '/inbox'; }

And if you use that pattern a lot then you can parameterise the function with whatever the route should be.

6 days ago by moojacob

I never thought about doing that. Thank you.

6 days ago by yxhuvud

Isn't the best way to solve the back button question to not be so damned complicated and just make certain that only things which you want to go back to ends up in the history? The whole framing of the problem just screams "structure your thing better and it won't be a problem to solve".

6 days ago by moojacob

Re-read it. We needed to preserve scroll position when you went back. If you just linked back to the inbox it would kick you to the top of the screen.

5 days ago by yxhuvud

That is not how the back button works in a regular browser. Something you are doing is breaking the default behavior. Stop that.

6 days ago by altbdoor

I know there will probably be some complications here and there, but this could be done with Web Components too, right?

6 days ago by jimbob45

Came to ask this myself. Oddly enough, I think they’ve kind of slipped under everyone’s radar.

6 days ago by kcrwfrd_

Yes you could, or even just a vanilla DOM event handler on a button click.

The problem is that you cannot introspect the browser’s history with the history API. So you have to hack your way around that if you want the “go back in history if possible, otherwise navigate to fallback url” behavior. Which I guess is easier if you’re in a react SPA. Or if you’re fully a MPA and can just check document.referrer

There’s a brand new Navigation API that does let you introspect history entries from the same origin, which perfectly addresses the issue.

I wrote a polyfill in order to take advantage of the navigation API for this exact problem: https://github.com/kcrwfrd/navigation-ponyfill

6 days ago by hieKVj2ECC

After spending so long writing React code, I'm now working on a large Vue project at work. Everyone used to say Vue was the easier of the two, the more approachable option — but I'm starting to see it differently. React, in its elegance, gives you components that are essentially just functions — and beyond that, there's not much more to it (setting aside the whole Next.js ecosystem). It's the most elegant thing I've encountered in frontend development. Vue, on the other hand, feels like a jumble. You can tell it was clearly adopted and glorified by backend developers who didn't want to properly learn JavaScript — and what emerged is this awkward mashup that never quite coheres into something clean.

6 days ago by b4ckup

I never get this take. A react component is not just a function, it's a function plus a magically injected context that is accessed through hooks which requires all kinds of guarantees that you have to be aware of otherwise it will have hard to debug consequences. Imo it's anything but elegant. I did projects in all major frameworks and am building a huge angular web app currently. In angular a component is represented as a class plus template (plus styles). A event listener is mostly calling a method on the class. A state can be as simple as a property on the class. It's very natural and there are way less caveats (although not zero).

6 days ago by satvikpendem

React uses an algebraic effectful function model which is elegant once one understands it: https://overreacted.io/algebraic-effects-for-the-rest-of-us/

5 days ago by b4ckup

So it makes sense because there's a fancy name for it? For a moment let's just imagine you are inventing a brand new UI framework. You obviously want to have components in it. So how do you represent a component in your new framework? A component needs state, logic and a way to render that state. Do you choose to represent the component as a class which naturally encapsulates state as properties and logic as methods or do you choose to represent components as functions which lack state so you bolt it on via an implicitly injected context that you access via abstractions?

6 days ago by mpweiher

> I never get this take. A react component is not just a function,

Exactly.

I did a somewhat longer writeup a while back.

https://blog.metaobject.com/2018/12/uis-are-not-pure-functio...

The pull request is still open :-)

6 days ago by SebastianKra

Interesting that you still stand by that, even after Apple moved to the exact same model with Swift UI.

Narrowmindedly worrying about syntactical differences is contributing nothing to the conversation. The point is relinquishing control of state to the framework (be it via props, hooks or @State), and drawing the UI as a pure representation of whatever the framework tells you. Hence ui = f(state). This gets you a metric ton of advantages, which is why every modern framework is doing it.

Classes, by themselves, are inadequate as containers for state unless that state must only exist in memory and never be observed, synchronized or serialized. You can attempt to patch that with decorators, ORMs or whatever, but now you're doing the same thing as React is doing with functions.

6 days ago by TonyStr

Maybe you would prefer React's class-based syntax. It's still there if you want to use it

5 days ago by b4ckup

I actually do and my critique is directed at function components which seems to be the standard nowadays.

6 days ago by TonyStr

How long have you used Vue? I had a similar opinion on Vue a few years ago, coming from a background of React as well. But now I prefer it over React, and reach for it in both personal and professional projects. The ergonomics are a bit different; there are things that are easier to do in React, and things that are easier to do in Vue, but the fact that it uses signals is a huge plus for me.

6 days ago by manlymuppet

More than React, I'm interested in the question of how to best write UI through code, in general.

Even though I'm a fan of React, and use it for practically every web application I build, my biggest and most obvious issue has been that writing UIs through React doesn't feel as natural as, say, writing command line tools in Go, or live/realtime apps in Elixir.

Some languages just feel incredibly natural and frictionless for certain things, and nobody has really nailed UIs yet. Swift, JSX/HTML, Svelte, or whatever framework of the week: they all feel like they're working around the problem to some extent. Like at some point in the process, the designers of the language/framework had to compromise and implement some hacky/weird/painful syntax to satisfy project requirements.

UI's natural interface is visual, so tools like Figma can serve as an essential part of the solution, but nonetheless, I feel there's something missing. There must be a more intuitive way to represent the visual through code. The current solutions, although I find it hard to describe precisely, are always tantalizingly lacking in one way or another.

6 days ago by OneOffAsk

I don’t think UI’s natural interface is visual. I think the natural interface is a state machine.

The most reliable and performant UI code I’ve written usually tackles this head on by thinking through all the possibilities of different states the application can be in and how the transition of each state should look. This can very quickly get mind boggling complex.

Systems programming languages seem like they model their problems better because it’s less common to ask a systems programmer for a like button that shows bubbles when you press it. If you model your UI explicitly like a state machine, you can say “no” to the bubbles like every systems programmer says “no” to most features, because you realize the explosion of state will be unmanageable. Or you can use a JavaScript framework and download a bubbles package and wonder why your app is buggy, but have job security.

6 days ago by kristiandupont

I feel similarly. I really liked React when it came out because compared to the alternatives at the time, it just felt perfect.

I still prefer it over almost everything, including Svelte, Vue and Solid. But I have started using Crank (https://crank.js.org/) which seems a step closer to where I want to end up. However, I have so far only used it for toy projects so I can't speak to how well it will scale, both in terms of performance and DX.

6 days ago by mpweiher

> Some languages just feel incredibly natural and frictionless for certain things, and nobody has really nailed UIs yet.

Emphatically yes. If you look at books written about the problem in the early 90s[1], they are still applicable today.

> The current solutions, although I find it hard to describe precisely, are always tantalizingly lacking in one way or another.

The best analysis of this I have seen so far is in Chatty's Programs = Data + Algorithms + Architecture: consequences for interactive software engineering [2]. It's a bit hard to get through, but absolutely worth it.

As a short summary, the problem is architectural, or more specifically linguistic/architectural mismatch: the architecture our "general purpose" programming languages induces, which is the call/return architectural style, does not match the architecture required for user interfaces, but rather conflicts with that style.

I also wrote about it in Can Programmers Escape the Gentle Tyranny of call/return?.

My current approach is to first build a programming language that can easily express alternative architectural styles: Objective-Smalltalk [4].

With that I am now working an a UI framework I call interscript, including HTMXNative and other goodies.

It seems to be working out...

[1] For example, Languages for developing user interfaces by Myers et al https://api.taylorfrancis.com/content/books/mono/download?id...

[2] https://opendl.ifip-tc6.org/db/conf/ehci/ehci2007/Chatty07.p...

[3] https://2020.programming-conference.org/details/salon-2020-p...

[4] https://objective.st

6 days ago by bakugo

As an engineer, it's easy to look at every problem and think to yourself: "There is a perfect solution for this, we just haven't found it yet."

Yet, as the years go by, I find myself accepting a less idealistic answer: Maybe there isn't. Maybe the problem space is just so complex that no one (humanly feasible) general solution exists for all forms of it. If there's one thing that this is true for, UI is probably it.

6 days ago by manlymuppet

Years are a pretty short time frame as it relates to technology, though. Even for software.

The solution might be well out of grasp now, but think 10, 20, 100 years from now. Somebody smart with a new perspective will eventually come around and tear out the roots, and we'll all be better for it. Perhaps what's holding us back isn't the problem itself, but the way we approach it and the assumptions we bring.

Trying is at least worth the effort, especially since "better" is very achievable, rather than total perfection.

6 days ago by sheepscreek

Yes! It is hands-down, the most intuitive interface, that has successfully married declarative and imperative styles together. IMO, nothing comes close to JSX across the length and breadth of UI frameworks across all languages.

6 days ago by MrBuddyCasino

If it is so intuitive, why then does basically every React app contain performance bugs?

6 days ago by Rohansi

What does being intuitive have to do with software optimization? You can write poorly performing code for anything. Most people never touch profilers.

6 days ago by MrBuddyCasino

The same kind of bugs don’t happen in Vue because the framework handles them for you.

6 days ago by bsimpson

Flutter, SwiftUI, Jetpack Compose: a whole lot of other platforms have been implementing React as their UI framework

6 days ago by pjmlp

No they are implementing Functional Reactive Programming, it isn't the same thing, even though common folks would say React.

https://wiki.haskell.org/Functional_Reactive_Programming

6 days ago by bsimpson

Isn't FRP more like RxJS/CycleJS?

If you ask the people who work on any of those frameworks I mentioned, they'll tell you they're taking the React style and applying it to their platforms.

6 days ago by EddieRingle

I wouldn't say Compose UI/Flutter/SwiftUI are "implementing React", but if your point is that other platforms have better solutions than JSX (plus all the bloat React adds to applications), I absolutely agree.

6 days ago by vjeux

I'm biased because I was part of the people that made it happen but yeah, I love React. Before that, I would try everything under the sun to fix the issues I was having doing front-end. But since React came out, I don't have this need anymore. I can just focus on building stuff.

6 days ago by jdw64

[dead]

6 days ago by suis_siva

One of the talks I really enjoyed is https://www.youtube.com/watch?v=h9SDuTSy7ps. In my experience, React's architecture is really good and lends itself quite well to making large applications.

Unfortunately, React's biggest problem is that it forces you into the JS/TS ecosystem, which is, without a doubt in my mind, a compilation target rather than a system I wish to interact with natively.

I'm happy with Elm -- the community is really small, and sometimes you have to roll your own libraries. TEA is sometimes... unnatural (coming from React), but the fact that you do not have to worry about implicit and unexpected state (see useEffect), I always get excited to work with Elm.

Additionally, Claude seems to manage itself better in Elm than in React, at least within large, scary codebases.

6 days ago by satvikpendem

Elm is essentially dead in my experience. I'd rather stick with React and TypeScript with libraries that continue to work. And there have been attempts at making TypeScript natively compilable too.

6 days ago by suis_siva

I wouldn't call Elm dead. Development has frozen, this is true, but X11's development was frozen and it still powered so much for decades. This is actually super common in the Clojure community -- many libraries look dead, but they're just feature-complete and FP is usually quite bug-free, when implemented correctly.

Totally recognize and agree with the lack of libraries -- that's really Elm's weakest side.

6 days ago by satvikpendem

The issue is Elm isn't feature complete though, at least not what its founder's vision is supposed to be, and they also aren't trying to improve it while berating users. This post [0] is as true as it ever was, including my comment there.

[0] https://news.ycombinator.com/item?id=43069475

6 days ago by 0x6c6f6c

I like TEA but don't fully grasp how it scales for apps that may have reusable components or sufficiently complex pages. Is there an agreed-upon way(s) to deal with this? I know state is a big NO so it seems a bit at odds, but also does this essentially mean all Elm apps are just a global Redux and React app with no effects? Curious about more details to what you enjoy and how you like to work in Elm. Links also perfectly fine too.

6 days ago by qsera

Not the person you were asking, but I shall share my experienc..

>how it scales for apps that may have reusable components or sufficiently complex

It is a lot of boilerplate, but it is mechanical, straightforward changes. I think it is entirely possible to automate it (not even using LLM).

> state..

I have used ELM ports to interact with JS and localstorage/indexeddb.

6 days ago by suis_siva

In my experience, the biggest problem in Elm is how unintuitive TEA's docs are. In some ways, Elm really feels like Haskell -- you want to avoid creating "stateful" modules and you prefer stateless modules.

For example, https://harmont.dev's app (landing page is not Elm) has a component to render a pipeline graph called DagGraph. In React, you'd do something like

  function DagGraph() {
    const steps = useState<Jobs[]>([]);
    const selectedJobIdx = useState<number | null>(null);
    return ...;
  }
In elm, I lift this up (I will keep using React syntax for the sake of wider-audience readability)

  function DagGraph({ steps, selectedJobIdx } : IDagGraphModel) {
    return ...;
  }
This allows for better testability of the graph view. The parent then injects the model

  function PipelinePage({ graphMode, selectedPipeline }: IPipelineModel) {
    return (
      graphMode === GraphMode.DagView
        ? <DagGraph steps={selectedPipeline.steps} selectedJobIdx={selectedPipeline.selectedStep} />
        : <TableView steps={selectedPipeline.steps} selectedJobIdx={selectedPipeline.selectedStep} />
     );
  }
Now -- we need to bubble up the selected pipeline index based on when the user clicks a node in the DAG view. I personally prefer to do this completely orthogonally to the view rendering pipeline (which remains mostly pure). I create a new model, and define the message relationships to it:

  namespace PipelineState {
    interface Model {
      steps: Step[];
      selectedStep: number | null;
    };

    interface ISelectStepMessage { stepIdx: number };
    interface IUnselectStepMessage;

    type Message = ISelectStepMessage | IUnselectStepMessage;

    function update(m: Model, msg: Message): Model { return...; }
  }

  // main model
  interface Model {
    pipeline: PipelineState.Model,
  }

  type Message = PipelineState.Message | SomeOtherMessage | ...;

  function update(m: Model, msg: Message): Model {
    switch (msg) {
      case PipelineState.Message as msg:
        return update(m, msg);
      ...
    }
  }
And this seems to work quite well. Personally, I really like this architecture, because it enables me to think about state and UI separately. One of the really big gripes I have with React is how most components end up with `useEffect` and `useState`, and then immediately become untestable. Elm literally doesn't allow for that.

At the end of the day, there's a trade-off -- my logic is no longer localized to the "component" relevant to rendering the pipeline DAG. I never have one file open editing Elm code, but I'm a vim user so it doesn't bother me. In some ways, semantically, I think it makes sense to split the "state backend" of your UI from your UI, in my opinion.

Most of my app states are represented as state machines (coming from embedded this is quite natural) and UI is represented as pure transformations of that state.

With Elm, it really feels like you reason about state and UI separately, and I actually prefer that, both for testability and that's just how my brain works.

Daily Digest

Get a daily email with the the top stories from Hacker News. No spam, unsubscribe at any time.