Live data from Hacker News

React is holding me hostage

emnudge.dev

501–510 of 553 posts

Re: React is holding me hostage

#502
post #318

I can't help but sigh exhaustedly. There was a moment in time angular was the thing. And then x. And another. And React. The problem each of them tried to solve, and continue to try to solve is purely lexical in the end. It's about writing things differently. Creating abstractions (terms) beyond what the underlying language/platform allows you to do. And this is not a bad thing. The solution really is to create your…

> The solution really is to create your own language so you can express the problem you are solving in the terms of the problem and not the underlying language/platform/hardware. That's what Elm is about. I've talked about it in another thread, so I won't repeat myself here.

I had heard of it, but never checked until you mentioned it in this context. It seems that Elm is an entirely new language written atop JS (or maybe not, and targets JS?). A DSL.

DSLs also usually are an incomplete solution. Unless they themselves allow adhoc language creation using the DSL as a base. Common Lisp with its macros allows writing DSLs quite off-handedly as you program. You grow your program and language together as you get deeper into your problem.

Re: React is holding me hostage

#503
post #483
post #382

Earlier quoted context omitted.

> JSX forces you into small tiny components I'm surprised you see that as a disadvantage, for me that's always the biggest advantage of JSX-style syntax! I don't want huge components that do everything, I want components to do as little as necessary to be actually useful. It's the same as if I were writing functions: keep them fairly small, make sure they're doing a specific thing usefully, and then compose them toge…

> I don't want huge components that do everything, I want components to do as little as necessary to be actually useful Having lots of tiny components makes it harder to see the big picture. Too big and too small are both bad, there's a balance you need to find. Components should be small enough to fit in your head, big enough to represent ideas. The difference is that it's natural for big components to be broken dow…

To a certain extent, I agree that you also don't want overly small components, but it feels a lot like the debate about function size. Sure, you don't want to wrap every statement in its own function, you want functions that are big enough to actually do something useful, but as a rule of thumb, smaller is better than larger.

This isn't a theoretical concern either. Like I said, I've had this issue with Vue before, and component sizes just bloated to the point where many pages were just single, chaotically interwoven components with dozens of state variables that theoretically were never used by each other, but in practice tended to be shared accidentally or out of short term convenience. At which point all bets are off and every bug becomes an exercise in figuring out what's going on.

That's not to say that that's a Vue-specific problem, because I've also had that issue in other frameworks, including React. But far less often in React, because it's much easier to deal with the pain when it starts with a simple refactor, than dealing with it a year and several new features down the line when everything is tangled together like a headphone cord in your pocket.

Re: React is holding me hostage

#504

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…

It's more like React is the MFC to HTML5's Win32. A not very good API with a near monopoly that people spend lots of time wallpapering over with ever more elaborate frameworks that end up being used only for distribution reasons.

It’s a pretty great API, I’d say! The alternatives also have their own warts.

Re: React is holding me hostage

#505
post #382

Earlier quoted context omitted.

> JSX forces you into small tiny components I'm surprised you see that as a disadvantage, for me that's always the biggest advantage of JSX-style syntax! I don't want huge components that do everything, I want components to do as little as necessary to be actually useful. It's the same as if I were writing functions: keep them fairly small, make sure they're doing a specific thing usefully, and then compose them toge…

I also love small and well thought components. But as an engineering lead and manager it’s a lot of effort wrangling devs to do so. They always start small and then overtime converge on multiple return statements full of huge amounts of inline JS.

I've been enjoying SolidJS recently, and due to framework limitations, it is generally impossible to have multiple return statements, which I think helps a bit here. The signals stuff also lends itself really well to writing code that operates only on state, and then plugging it into a thinner, dumber DOM layer, so it's easier to compose pieces together. It's like hooks or the Vue composition API, but moreso? It's difficult to describe.

That said, SolidJS as a whole requires a completely different mental model of rendering, even if it does look superficially similar to React. It's also a much smaller ecosystem, with less documentation, so getting to grips with it is that much harder. Very rewarding, but probably not ideal for everyone right now.

Re: React is holding me hostage

#506
post #468

Earlier quoted context omitted.

Jotai is literally like a single file. Here's a video on how to use Jotai by writing your own in minutes: https://youtu.be/gg31JTZmFUw

Jotai may be small and focused, but is definitely not a single file: https://github.com/pmndrs/jotai/tree/main/src/

Yes, sorry my bad, the project isn't a single file. I was just talking about the implementation.

Re: React is holding me hostage

#507

I never understood why React became so popular. I thought it was a kind of mass hysteria. I was exposed to a broad range of front end frameworks early in my career (Backbone, SproutCore, JavaScriptMVC/CanJS, AngularJS), one of my colleagues was experimenting with Google's PolymerJS and recommended it. After trying it out, I was blown away by its elegance and simplicity. Yet somehow it never caught on. When React came…

I’ve tried Polymer and the web componens, and for a long time it had a really bad accessibility story, and even worse developer experience. It is just google using their size to force bad decisions on the web world again.

Re: React is holding me hostage

#508
post #362

I don't understand the animosity around useEffect. It executes a function based on a list of dependent variables. That's it. Once you understand that, its purpose becomes very clear. You don't want to rerender? Use useEffect with an empty array! Or don't use any state variables! You want to show something new to your customers / users without rerendering? Well sorry, that's impossible, regardless of any framework you…

> You want to show something new to your customers / users without rerendering? Well sorry, that's impossible, regardless of any framework you use and you should go back to UI development 101. When you say “render” are you referring to what React means by “render”, that it will go through the whole virtual DOM cycle? Because it most certainly is possible to avoid that when using pure JavaScript. Why do you say it’s i…

To show something new to the user, state must be calculated and pushed either to the DOM or blitted to a canvas.

Re: React is holding me hostage

#509
post #421

Earlier quoted context omitted.

Jira is a not very good product, implemented by worse engineers, that happens to be better than its competitors (ironically proving the point I made further up thread).

> implemented by worse engineers Jira is a 20 years old piece of software. I'm sure today's engineers do their best with the constraints they have. And I'm sure the 2002 engineers did their best with this period's assumptions and solutions. I hate Jira as a product, but please don't attack people like that, have you never had to work on a product you're not 100% satisfied with? :/

Hasn't Jira been rewritten from scratch a few years ago?

Re: React is holding me hostage

#510
post #93

As a more backend guy who does some frontend, the main thing I like about React over alternatives like Svelte, Vue and SolidJS is React Native. React is maybe not perfect for the web, but it’s very, very good, and it’s also quite good for mobile via React Native. The more purely web-focused libs/frameworks have far inferior (or no) mobile options, while other cross-platform frameworks, like Flutter, suck on the web.…

I'm using React Native to build mobile games, and I am pleasantly surprised I can just write my own state management and update logic (hack around states and props) to walk around a lot of issues and get good performance.

Interesting, how are you drawing graphics? Skia?
Post reply on HN