Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Cannot agree more! Mastering React is ridiculously hard for what it is. There are so many “buts,” “it depends,” and subtle differences to navigate, like useEffect vs. useLayoutEffect. But don't forget useEffect is an evil in the first place and so on, and so on.

It feels like a clever proof of concept with a leaky abstraction at its core, one that no amount of effort can truly fix, no matter how much they throw at it. They’re even building their own compiler. A compiler. For something that’s supposed to represent the V in MVC.

As a SPA framework, it’s questionable. But using React to build server-side apps? That’s beyond absurd for me, it’s like Electron for the backend, only worse. And yet, the industry loves to pretend otherwise, so here we are.



React is a guided missile foot gun. You can figure out how to have it hit something else, but even when you aren’t pointing it at your foot, it’s probably going to hit your foot. You can have that feeling of wonder as the rocket sails off into the distance, and then just as you get customers, it comes back over the horizon and hits your foot. Experienced physicists and rocket scientists can override the guidance mechanism and have a much better chance of not hitting a foot, but who has time for that. Most people just like that it has a big red button labeled “Shoot” that’s easy to press.


You shouldn't write a single useEffect in the first year or two of your career in React.

Why people are so keen on stabbing themselves just because there's one or two weird shaped forks in the kitchen drawer. Why do suddenly everyone tries to use it for spreading butter or peeling eggs?

Just understand what unidirectional data flow is and you are golden. You know the entirety of React you should be using for your first year of full-time job.


That’s true. Just to note, I never claimed otherwise. See, useEffect is an evil remark. This is more based on my experience working with an average React codebase.

As for your question, “Why does everyone suddenly try to use it for spreading butter or peeling eggs?”

I guess part of the reason is that many people rely on older tutorials and patterns where the usage of useEffect was much more tolerated or even encouraged as a catch-all solution. There’s still a lot of inertia from the old componentDidThis/componentDidThat paradigm, with useEffect being its direct replacement.

I feel it is only a recent tendency to finally abandon the overuse of effect hooks.

Just open an average Stack Overflow React question, and you’ll see how many useEffects are crammed in there.


How do you fetch and persist server side data without useEffect? (Assuming vanilla react)


That’s probably the main real-world use case for useEffect. Dedicated third-party libraries like React Query obviously use useEffect under the hood as well


Yeah that's what I thought -- all the React codebases that I've worked in are riddled with `useEffect` for this reason primarily.


I'm jealous, then. I've seen all kinds of deranged Rube Goldberg machines built using useEffect




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: