Live data from Hacker News

React is holding me hostage

emnudge.dev

151–160 of 553 posts

Re: React is holding me hostage

#151

Earlier quoted context omitted.

> People tend to compare these frameworks on things that don't matter - often it's performance. Performance people get offended when they hear things like that. I imagine what they will tell a person who says something like this is to: - Look at the traces. Real metrics, on real devices that users have, not the one that developer has. - Consider either large contentful paint (will likely be subpar with client-side re…

"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.

Re: React is holding me hostage

#152

Earlier quoted context omitted.

The bit of react that is f ( newState ) => UI is the easy part. The bit that is g ( state , userInput ) => newState is the hard part. In particular managing the scope of that newState . Oh, and sometimes you need to handle h ( state , asynchronousData ) => newState too. And then comes the fact that even though your f is _pure_, it also has to be _fast_, because it's going to run every time you get a newState .

In my experience redux-toolkit + redux-saga for async stuff usually work really well. In case of performance problems one can go with profiling + targeted optimisations (e.g. a separate store, some locally managed state).

Yes, absolutely. Don't use useEffect as an async framework, use thunks or sagas.

Remove most logic from the components into sagas,thunks and selectors.

That way your components will be smaller, more testable, easier to change, easier to reason about.

Re: React is holding me hostage

#153

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.

Re: React is holding me hostage

#154
post #144

Earlier quoted context omitted.

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…

> a lot of the form libraries out there triggered huge numbers of rerenders and caused perf issues Something I don’t quite get, doesn’t useRef just solve the re-render issue?

Sure, but then you're managing state and re-renders yourself. Kinda defeats the purpose of using the framework, right? The useRef() approach to fixing performance is the main reason why I think Signals are popping off. Users of frameworks like Vue and Svelte have felt this way for a long time.

Re: React is holding me hostage

#156

Earlier quoted context omitted.

In my experience redux-toolkit + redux-saga for async stuff usually work really well. In case of performance problems one can go with profiling + targeted optimisations (e.g. a separate store, some locally managed state).

I had to rescue a redux-saga project that went badly off the rails. It was one of the most inscrutable and difficult to debug codebases I've ever had to work with. Forget completely about ever having a usable stack trace.

Yes, I guess you can abuse every technology. Sagas are always sideeffects and thus have to be used with restraint.

Sagas keep state (and you should keep most state in the redux store, anyway).

So, yes, you can go wrong, as with everything else. But it's better than using useEffect as an async framework.

Re: React is holding me hostage

#157

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 people disagree on.

Re: React is holding me hostage

#158

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 less).

> It's just the useEffect hook. Unfortunately that's a big problem. That hook should never have existed.

Weird. useEffect is like the archetypal hook. The problem it purportedly solves was one of the main arguments they made for hooks existing in the first place -- https://reactjs.org/docs/hooks-intro.html#motivation. They just implemented it in a clunky way, and actually the problem could have been solved in an OO fashion without going to hooks at all, but now everything is a fucking hook.

Re: React is holding me hostage

#160

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…

Admittedly I haven't worked on a large multi team react project before but I thought the whole point was that Facebook found React scaled well with teams (vs the state of the art at the time)

Not only can you componentise your UI code, but you can componentise your UI system meaning teams can develop independently of each other...

Post reply on HN