Live data from Hacker News

React I love you, but you're bringing me down

marmelab.com

501–510 of 574 posts

Re: React I love you, but you're bringing me down

#501

Earlier quoted context omitted.

Yes, there is something very weird indeed. Functional components are called every time they're rendered (that's not weird). But they have to maintain state between calls; they can't start over again fresh for each call/render (still not weird). So how do they do this? `const [state, setState] = useState(initialValue)`. You might look at that and think, I see useState being called, so it must be called on each render,…

That is bonkers, to be honest. I've used React a lot, but only via Reagent in ClojureScript. I think the JS people are being scammed.

It's sort of what happens when OOP is demonized for years and FP is lionized. They've created what are effectively classes but with implicitly auto-generated private property names and a lot of weird edge cases where things can go pear shaped. But hey, it's functional and 'new' so it's good, right?

In fairness, the JS world has never had well engineered OOP GUI toolkits like you find in the desktop space. If you've never used JavaFX then ReactJS probably seems pretty magical. If you have, then, well ...

Re: React I love you, but you're bringing me down

#502

I must be the only person in the world who likes class components in React. Sure, it's often overkill and a functional component does the same thing with less code. Use a functional component in these cases. But if you're doing something more complicated then stop treating class components like the fucking devil. They have their place.

I am in the same boat. I miss class components so much, but because of the trend it is hard to fight for it. It is just so verbose and easier to read. It is more in line with the majority of graphics/ui frameworks in the whole software engineering ecosystem. It reminds me of render loop in many game engines, along with special event triggers (mount, unmount etc.). It makes me feel like an actual programmer, rather than a "view orchestrator"...

Re: React I love you, but you're bringing me down

#503

Earlier quoted context omitted.

Where are good examples of clean, well-implemented React code by your definition? Because your comment perfectly encapsulates my experiences and frustrations in learning and using React off-and-on over the past 8 years or so. React is the one tech that really freaks me out because every time I have to dive into it, it's a completely different beast and it feels like so many people actually writing in React are just e…

> your comment perfectly encapsulates my experiences > feels like so many people actually writing in React are just effing CRAZY Same here. We had an experienced-but-batshit-crazy dev create a React site with approximately 250,000 LOC to support 3 forms with a max of 4 simple inputs and a 3-column data table view. To this day it makes my head spin how it is even theoretically possible to write that much code for so l…

So you're using the code of a maniac to judge an entire framework?

Re: React I love you, but you're bringing me down

#504

Earlier quoted context omitted.

That is bonkers, to be honest. I've used React a lot, but only via Reagent in ClojureScript. I think the JS people are being scammed.

It's sort of what happens when OOP is demonized for years and FP is lionized. They've created what are effectively classes but with implicitly auto-generated private property names and a lot of weird edge cases where things can go pear shaped. But hey, it's functional and 'new' so it's good, right? In fairness, the JS world has never had well engineered OOP GUI toolkits like you find in the desktop space. If you've n…

You might need to re-read my comment.

ClojureScript is a functional language.

Reagent is a ClojureScript wrapper over React.

Cljs + Reagent is AWESOME.

There is a JavaFX wrapper too, with a similar API.

Re: React I love you, but you're bringing me down

#505
post #441

Earlier quoted context omitted.

That is bonkers, to be honest. I've used React a lot, but only via Reagent in ClojureScript. I think the JS people are being scammed.

I don't know why Clojurescript's Reagent/re-frame aren't more popular given that they completely obviate the need for hooks or classes.

I think someone should make a Reagent for JS.

Re: React I love you, but you're bringing me down

#506
post #376

Earlier quoted context omitted.

suggesting the concurrency features can simply be broken off is evidence that you may not understand them as well as you imply.

Sorry, to clarify: What I'm suggesting is that React 18's changes were substantial enough to have been broken off into a separate library, not maintained inside of React. I don't mean to diminish the teams amazing work here, but they're overkill for 90% of the developer community who are already having a hard time understanding all of the abstractions that have made it in since hooks were added. All of this is _overw…

Amen. React 18 was the moment where they forgot they started as the V in MVC.

Concurrent React was a mistake, and the hooks they had to add to make it work too.

The main example I always cite of where the React team is naive is mousemove handlers:

- there is no guarantee that react will re-render between two mousemove events

- even if it did, creating a new mousemove handler after every move is ridiculous

- avoiding this using the `setState(s => s)` form doesn't work if you have multiple pieces of state or need to invoke other callbacks

Therefore, every mouse dragging UI I've built has used useRef instead, mutating state directly.

The answer from the react team to this seems to be.... nothing. They just say it's bad to mutate state and that it will lead to bugs, seemingly not realizing that so will useEffect for the reasons above.

I think OP is wrong, and that people who have never built an app with undo/redo don't know what they're talking about when it comes to front end dev... but the React team is definitely chasing the wrong ideas.

Also, forms utterly suck as a UI, and every form abstraction I've ever used was terrible and ran into a wall. It just seems pointless to try to optimize for it.

If some people want to make forms easier because it's most of what they do day to day... hint, they're atrocious front end developers.

Re: React I love you, but you're bringing me down

#507

Any general coders wondering about React as their first front end framework - just use Vue. It’s easier, makes quite a lot more sense, has a “one true way” approach regarding many topics and can be comfortably learnt in a day. It’s easier for others to understand your code too. JSX yuck.

Would you say Vue 2 or Vue 3 would be better for someone venturing into Vue? Also, have you used Svelte much?

Vue 3 is more exciting, but I'm stuck on Vue 2 for my real work due to dependencies. Much of Vue 3 has been backported, and you can use Vue 3 like Vue 2, so it doesn't matter too much... probably go for 3 as it's the standard now.

I've looked at Svelte. I was deterred by lack of ecosystem. Vue's is just big enough to be workable, I think Svelte doesn't offer enough to reach the Vue/React size - probably.

Re: React I love you, but you're bringing me down

#508
post #417

Earlier quoted context omitted.

Would you say Vue 2 or Vue 3 would be better for someone venturing into Vue? Also, have you used Svelte much?

Easily Vue 3, the dev tooling/xp + docs are much better over Vue 2.

Oops yes this is a very good point I missed.

Re: React I love you, but you're bringing me down

#509

Earlier quoted context omitted.

It's sort of what happens when OOP is demonized for years and FP is lionized. They've created what are effectively classes but with implicitly auto-generated private property names and a lot of weird edge cases where things can go pear shaped. But hey, it's functional and 'new' so it's good, right? In fairness, the JS world has never had well engineered OOP GUI toolkits like you find in the desktop space. If you've n…

You might need to re-read my comment. ClojureScript is a functional language. Reagent is a ClojureScript wrapper over React. Cljs + Reagent is AWESOME. There is a JavaFX wrapper too, with a similar API.

I know, but you didn't actually say you think React is awesome when not using JS. Given how JS specific React is, that's not a very intuitive outcome.

The comment was in response to "that's bonkers". And that has been my reaction on learning stuff like React and derived frameworks. A lot of it looks like functions for the sake of it, when objects already solve those problems but became unfashionable.

Re: React I love you, but you're bringing me down

#510

Any general coders wondering about React as their first front end framework - just use Vue. It’s easier, makes quite a lot more sense, has a “one true way” approach regarding many topics and can be comfortably learnt in a day. It’s easier for others to understand your code too. JSX yuck.

Would you say Vue 2 or Vue 3 would be better for someone venturing into Vue? Also, have you used Svelte much?

Vue 3. Apart from the fact that it is modern and has more features, It uses proxies, so it doesn’t have the vue2’s reactivity gotchas.
Post reply on HN