Live data from Hacker News

Kind of annoyed at React

blog.cassidoo.co

131–135 of 135 posts

Re: Kind of annoyed at React

#131
post #121

Earlier quoted context omitted.

Okay, but my point is that somewhere along the line there always is a useEffect() that reacts to something. Maybe it's in your own component, maybe it's in a third party component.

I don't agree with your point. You can use state setter from outside of react and inside react rely only on state and props and not use useEffect() at all. You don't need useEffect() to react to anything. React itself reacts to state and props change. You'll do yourself a favor if you ban yourself from using state setters inside useEffect(). Try it.

I think that would only make my apps much more complicated, and also more difficult to understand and to develop, since they would not rely on standard React API but some kind of outside integration. I don't really see the value.

Re: Kind of annoyed at React

#132
Many people tend to gain a good understanding of React by building on top of it. Unfortunately, majority of the tutorials, lessons, recommendations, and paid courses usually start off using a framework where a lot of stuff have already been added. The effort to simply understand a complex setup as compared to starting React with the bare minimum and slowly adding whatever packages / libraries are needed.

React should start by a simple initialization: -> Setup React -> CSS library -> State management

And then, other packages or libraries can be considered to be added whenever the current needs of the application exceeds what the bare minimum setup has provided.

While in the end the set of packages and configurations performed may tantamount to what a framework already provides easily, the cognitive load starts on a piece that is well understood and grows alongside the evolution of the software product being delivered.

Re: Kind of annoyed at React

#133
post #131

Earlier quoted context omitted.

I don't agree with your point. You can use state setter from outside of react and inside react rely only on state and props and not use useEffect() at all. You don't need useEffect() to react to anything. React itself reacts to state and props change. You'll do yourself a favor if you ban yourself from using state setters inside useEffect(). Try it.

I think that would only make my apps much more complicated, and also more difficult to understand and to develop, since they would not rely on standard React API but some kind of outside integration. I don't really see the value.

> I don't really see the value.

One benefit is performance. useEffect() causes cascading updates when it alters state.

The other is that it's way harder for your code to turn into spaghetti if you don't sidestep the whole concept of React where raw events trigger global state updates which causes react to do automatic re-render of UI which provides user with means of generating events. React should have one large loop, not multitude of small ad-hoc ones built on the side with useEffect().

Re: Kind of annoyed at React

#134
post #131

Earlier quoted context omitted.

I think that would only make my apps much more complicated, and also more difficult to understand and to develop, since they would not rely on standard React API but some kind of outside integration. I don't really see the value.

> I don't really see the value. One benefit is performance. useEffect() causes cascading updates when it alters state. The other is that it's way harder for your code to turn into spaghetti if you don't sidestep the whole concept of React where raw events trigger global state updates which causes react to do automatic re-render of UI which provides user with means of generating events. React should have one large loo…

These have not been an issue in my projects.

Re: Kind of annoyed at React

#135
post #134

Earlier quoted context omitted.

> I don't really see the value. One benefit is performance. useEffect() causes cascading updates when it alters state. The other is that it's way harder for your code to turn into spaghetti if you don't sidestep the whole concept of React where raw events trigger global state updates which causes react to do automatic re-render of UI which provides user with means of generating events. React should have one large loo…

These have not been an issue in my projects.

You do you. But notice how many people here complain about performance and piling up mess in their React projects. Avoiding useEffect is a way to avoid those issues.
Post reply on HN