Live data from Hacker News

React is holding me hostage

emnudge.dev

171–180 of 553 posts

Re: React is holding me hostage

#171
post #105

Earlier quoted context omitted.

I get so lost in these conversations, because I've been the lead on a relatively complex React app for literally years now and none of any of this has mattered or come up in any way whatsoever. Our app is plenty fast/responsive, maintenance hasn't been perfect but it's been manageable, same with new features... The learning curve around context was a bit steep but we get it now and haven't had any issues since. It's…

Depends on what kind of so your building. For a while, a lot of the form libraries out there triggered huge numbers of rerenders and caused perf issues. That's still a problem, though some of it has gotten better uncontrolled components. Timing-based UIs are (such as a sequence of triggered animations) can get really messy really fast. I've seen some really messy bugs in a app that had visuals and audio tied to diffe…

I've worked on a form + animations based site ~2 years ago. Forms via higher-order functions, it was a full-stack NextJS thing. Without TS.

I had to eventually claw my eyes out and that solved part of my problems, at least I did not see the boilerplate and the ugliness.

Then soon after that we worked on a similar thing (form + draggable carousel with snap to grid animation) in Angular with Material.

And my conclusion is that whichever framework you pick, whatever libraries you end up using, you must have a strategy to allocate your time and maintenance budget, and many many many times the sane compromise is to write something in raw JS and encapsulate that in whatever the framework gives you, and move on. Don't try to solve it within the framework, because it's just not worth it.

Re: React is holding me hostage

#172
post #50

Not to start an unholy flame war, but if you were to start a new project and didn’t need to worry about the ecosystem or workforce, what framework would you choose? Vue? Svelte? Something else?

I'm interested in what's happening in the MPA space. The Page and View Transitions API that the chrome team is working on, partial update libraries like htmx and unpoly, etc. If payloads are tight and servers snappy, many of the concerns that led to complex SPA architectures in the first place have begun to wither away.

Hotwire and Stimulus are great. They’re widely used within the league of “sprinkles” libraries and it’s well maintained. You can use it with any backend framework. I use it with Laravel and it’s a pleasure to work with. But it’s not trendy or fashionable, so expect a lot of looking down at you for using it.

Re: React is holding me hostage

#173

There is this niche movement that argues that good code should be very long lived. It should solve problems in a fundamentally efficient way that makes it hard to turn into obsolete and throwaway code. There are not many examples of such code bases. Maybe numerical algebra libraries come close. Reading through the comments it seems that providing (fairly basic by now) UI functionality on cross-platform basis has not…

> Surely people can find better use for their time and energy than churning through half-baked frameworks? We should have all stayed on backbone or Prototype.js with that logic. People look for alternatives because the status quo is awful (slow, verbose, footgunful). You’re saying “who needs cars when we got horses? Cars break down all the time”

No, when you mention js libraries you are already starting the clock way too late.

The UI problem is not new. People were already building clunky UI cars long ago. MFC was introduced by Microsoft in 1992.

Of course the emergence of the web platform and mobile/touch devices complicates the matter as you now have a proliferation of platforms to address (desktop native, desktop web, mobile native, mobile web) but my argument is that fundamental patterns on how to do this efficiently should have emerged by now - and I see exactly the opposite.

It would be nice to see some sort of convergence. Reinventing the wheel might be "fun" or gainful in a narrow sense but it certainly doesn't help with productivity.

Re: React is holding me hostage

#174

``` The quickest obstacle you’ll run into as someone new to React will be something like this function MyComponent() { const [num, setNumber] = useState(42); // infinite loop setNumber(n => n + 1); return {num} } Trying to make state updates at the top level of a component will result in an infinite loop. ``` I've taught React to dozens of people without ever seeing someone try this. A render function is an idempoten…

This is because people forget that React is still a only "view" library with the M and C sprinkled all over with meathooks. ¯\_(ツ)_/¯

Re: React is holding me hostage

#175
post #163

Earlier quoted context omitted.

I read this sentiment as basically saying the users experience of the app matters less than the experience of the dev who works on it.

My reading is the opposite. Basically all real end-to-end UX (actual performance included) depends on a collaborative effort. Someone mentioned that React is slow, it might take 200ms to update many elements.... and? Unless someone is making a fast-paced interactive game of DOM elements, it doesn't matter. Structuring the UX in a user friendly way matters infinitely more.

Structuring the UX in a user friendly way matters more, that doesn't mean random 200ms lags are OK. As you said, performance is UX too.

I hear normal, non-tech people with average hardware complain about "lagginess" of their machines all the time. And usually the only application they use is Chrome. They won't say that they had a 200ms lag when they clicked on a button, but the overall experience degrades when things are slow to respond. And when you sit that person in front of a good, optimized, snappy application, they will sing praise. Not particularly because of performance, but they will enjoy using it more, and they won't be able to explain exactly why.

You'd think that with the ridiculous amounts of money software engineers are paid to do what they do, they'd be able to swallow slightly more difficult collaboration and developer experience in order to deliver a more quality product. Forgive me for being harsh, and I don't mean this as directed to you (I don't know you), but our industry behaves like a bunch of babies.

Aside: if you're making an interactive game, you have 16ms to respond and render, not hundreds. In 16ms, modern games dispatch draw calls for millions of triangles, do AI, physics, netcode, level streaming and other bookeeping. Yet the teams there collaborate just fine.

Re: React is holding me hostage

#176

I'm still a React guy. I've also worked with Angular and Vue and toyed with Svelte. People tend to compare these frameworks on things that don't matter - often it's performance. We used to compare React performance to AngularJs performance too, which was meaningless. VDom is nice. Reactivity in signals is nice. Limiting rerenders is nice. But I choose frameworks because of developer ergonomics. The killer feature for…

> Most frameworks outside react still use templates. Even when they support JSX like syntax (aka vue 2.0) the default are templates. Templates are a no go for me. I use them for blogs or static websites, but applications are easier to make and maintain with actual javascript. I've gravitated away from React towards Vue v3. Templates are working fine, well even. You still use similar amount of Javascript (probably les…

I'm interested in hearing more about that last point.

Re: React is holding me hostage

#177

I'm still a React guy. I've also worked with Angular and Vue and toyed with Svelte. People tend to compare these frameworks on things that don't matter - often it's performance. We used to compare React performance to AngularJs performance too, which was meaningless. VDom is nice. Reactivity in signals is nice. Limiting rerenders is nice. But I choose frameworks because of developer ergonomics. The killer feature for…

Your dislike for ‘templates’ is much more a matter of personal preference than you’re letting on. Using language like “still using templates” makes me think that you don’t see any valid opposing view. I do not like JSX. It’s not worth talking about why. It’s not an argument I want to have. But framing non-JSX approaches as objectively inferior is not in tune with the reality, being that this is something sensible peo…

> Templates are a no go for me

It’s pretty hard to get more “this is my opinion rather than a statement of objective fact” than this.

> I do not like JSX. It’s not worth talking about why. It’s not an argument I want to have.

Ok.

Um… well, it’s hard to have a discussion if you won’t talk about it…

…but, “code” templates allow autocomplete and type checking in a way that is an objectively distinctive superset of text templates.

It’s because they are code.

A template is (almost always) a weakly typed DSL. Written, ignoring all the history of language design… by a bunch of folk who don’t really know how to write programming languages. …and, they. Are. Bad. Not always… but often. …because writing a language is hard, and because (reason) you can’t ever use an existing template language. Oh no. This framework has to have its own unique one, because otherwise it doesn’t integrate tightly.

Do you like DSLs? Or do they just hide the complexity somewhere else? What if the DSL is bad, not orthogonal in its feature set, poorly implemented …but cute, and useful for a very very narrow use case.

Isn’t the main critique of react that it hides complexity by moving it from one place to another?

Don’t you think it’s a tiny bit ironic that all the other templates based languages with their custom template DSLs are doing the same thing?

Anyway; I think it’s fair to evaluate template languages as what they are: DSLs.

JavaScript is a better language than most template languages by a variety of metrics. Other languages are better than JavaScript, absolutely… but, never, have I seen a template language that is.

You can love declarative configuration all you want, but it’s very very difficult to argue that just because you can make a mess with procedural approaches that they are worse; because they are a strict superset of what’s possible using the declarative approach.

…so sure. I don’t but “JSX is easier to maintain”, but it’s distinctly superior in capability.

Re: React is holding me hostage

#179

I've been feeling the same sentiment as the author. Having worked on 3 sizable React projects now (all started before I arrived), I can only conclude that beyond a toy phase -- once you have many hands working on React and *particularly* once you start managing sizable state -- there is only pain. The most recent case resulted in spending quite a bit of time explaining to a peer why we were experiencing an unexpected…

React definitely continues to innovate. Functional components and hooks were a huge innovation to class components and significantly improved the ergonomics of the library. That was only a few years ago. The team is actively working on RSC (react server components) which will have a similarly large impact on react's capabilities. Frameworks like remix and next will be able to leverage and build on this to create even…

React isn’t moving fast. React server components were announced two years ago and are still not available.

That said, as a low-level library it should not move fast; it should make sound design decisions while maintaining compatibility. It’s completely open to frameworks with more opinions and friendlier DX to be built on top of it.

Re: React is holding me hostage

#180

Earlier quoted context omitted.

"Performance" matters a lot less than many other things like collaborating with other people, or getting the DOM manipulation right.

I read this sentiment as basically saying the users experience of the app matters less than the experience of the dev who works on it.

The performance "disadvantage" of react (compared to what? SolidJS? handcrafted JS? some WASM thing?) is so small a user won't notice it in most apps in most places even if you don't actually optimize things.

Then indeed, abstractions a team can agree on matter more. Getting state management right matters. Hiring people and getting them productive quickly matters. Those are strong points in favor of React and even Angular, to an increasing degree for Vue, Svelte and others.

Post reply on HN